Skip to content

Commit

Permalink
Rename. #677
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyoung committed May 20, 2017
1 parent d3744bc commit 62dd762
Show file tree
Hide file tree
Showing 71 changed files with 144 additions and 218 deletions.
2 changes: 1 addition & 1 deletion src/Foundation/Core/AbstractAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract class AbstractAPI
*/
public function __construct(AccessToken $accessToken)
{
$this->setAccessToken($accessToken);
$this->accessToken = $accessToken;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Broadcast.php.
* OfficialAccount Broadcast Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -24,10 +24,7 @@
use EasyWeChat\Exceptions\HttpException;
use EasyWeChat\Foundation\Core\AbstractAPI;

/**
* Class Broadcast.
*/
class Broadcast extends AbstractAPI
class Client extends AbstractAPI
{
const API_SEND_BY_GROUP = 'https://api.weixin.qq.com/cgi-bin/message/mass/sendall';
const API_SEND_BY_OPENID = 'https://api.weixin.qq.com/cgi-bin/message/mass/send';
Expand Down
22 changes: 11 additions & 11 deletions src/OfficialAccount/Broadcast/MessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class MessageBuilder
* @var array
*/
private $msgTypes = [
Broadcast::MSG_TYPE_TEXT,
Broadcast::MSG_TYPE_NEWS,
Broadcast::MSG_TYPE_IMAGE,
Broadcast::MSG_TYPE_VIDEO,
Broadcast::MSG_TYPE_VOICE,
Broadcast::MSG_TYPE_CARD,
Client::MSG_TYPE_TEXT,
Client::MSG_TYPE_NEWS,
Client::MSG_TYPE_IMAGE,
Client::MSG_TYPE_VIDEO,
Client::MSG_TYPE_VOICE,
Client::MSG_TYPE_CARD,
];

/**
Expand All @@ -70,8 +70,8 @@ class MessageBuilder
* @var array
*/
private $previewBys = [
Broadcast::PREVIEW_BY_OPENID,
Broadcast::PREVIEW_BY_NAME,
Client::PREVIEW_BY_OPENID,
Client::PREVIEW_BY_NAME,
];

/**
Expand Down Expand Up @@ -140,9 +140,9 @@ public function build()
}

// 群发视频消息给用户列表时,视频消息格式需要另外处理,具体见文档
if (isset($this->to) && is_array($this->to) && $this->msgType === Broadcast::MSG_TYPE_VIDEO) {
if (isset($this->to) && is_array($this->to) && $this->msgType === Client::MSG_TYPE_VIDEO) {
$this->msgType = 'video';
} elseif ($this->msgType === Broadcast::MSG_TYPE_VIDEO) {
} elseif ($this->msgType === Client::MSG_TYPE_VIDEO) {
$this->msgType = 'mpvideo';
}

Expand Down Expand Up @@ -173,7 +173,7 @@ public function buildPreview($by)

if (empty($this->msgType)) {
throw new RuntimeException('Message type not exist.');
} elseif ($this->msgType === Broadcast::MSG_TYPE_VIDEO) {
} elseif ($this->msgType === Client::MSG_TYPE_VIDEO) {
$this->msgType = 'mpvideo';
}

Expand Down
2 changes: 1 addition & 1 deletion src/OfficialAccount/Broadcast/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['broadcast'] = function ($pimple) {
return new Broadcast($pimple['access_token']);
return new Client($pimple['access_token']);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Card.php.
* OfficialAccount Card Client.
*
* @author overtrue <[email protected]>
* @copyright 2016 overtrue <[email protected]>
Expand All @@ -27,7 +27,7 @@
use EasyWeChat\Support\Arr;
use Psr\Http\Message\ResponseInterface;

class Card extends AbstractAPI
class Client extends AbstractAPI
{
/**
* Cache.
Expand Down Expand Up @@ -212,7 +212,7 @@ public function jsConfigForAssign(array $cards)
* @param string $cardId
* @param array $extension
*
* @return string
* @return array
*/
public function attachExtension($cardId, array $extension = [])
{
Expand Down Expand Up @@ -834,7 +834,7 @@ public function getCache()
}

/**
* Set Api_ticket cache prifix.
* Set Api_ticket cache prefix.
*
* @param string $prefix
*
Expand Down Expand Up @@ -880,7 +880,7 @@ public function getTicketCacheKey()
*
* @param string $url
*
* @return Card
* @return Client
*/
public function setUrl($url)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OfficialAccount/Card/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['card'] = function ($pimple) {
$card = new Card($pimple['access_token']);
$card = new Client($pimple['access_token']);
$card->setCache($pimple['cache']);

return $card;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* CustomerService.php.
* OfficialAccount CustomerService Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -24,10 +24,7 @@
use EasyWeChat\Foundation\Core\AbstractAPI;
use EasyWeChat\Support\Collection;

/**
* Class CustomerService.
*/
class CustomerService extends AbstractAPI
class Client extends AbstractAPI
{
const API_LISTS = 'https://api.weixin.qq.com/cgi-bin/customservice/getkflist';
const API_ONLINE = 'https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist';
Expand Down
6 changes: 3 additions & 3 deletions src/OfficialAccount/CustomerService/MessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ class MessageBuilder
/**
* Customer service instance.
*
* @var \EasyWeChat\OfficialAccount\CustomerService\CustomerService
* @var \EasyWeChat\OfficialAccount\CustomerService\Client
*/
protected $customerService;

/**
* MessageBuilder constructor.
*
* @param \EasyWeChat\OfficialAccount\CustomerService\CustomerService $customerService
* @param \EasyWeChat\OfficialAccount\CustomerService\Client $customerService
*/
public function __construct(CustomerService $customerService)
public function __construct(Client $customerService)
{
$this->customerService = $customerService;
}
Expand Down
4 changes: 2 additions & 2 deletions src/OfficialAccount/CustomerService/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['customer_service'] = function ($pimple) {
return new CustomerService($pimple['access_token']);
return new Client($pimple['access_token']);
};

$pimple['customer_service_session'] = $pimple['customer_service.session'] = function ($pimple) {
return new Session($pimple['access_token']);
return new SessionClient($pimple['access_token']);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Session.php.
* OfficialAccount CustomerService Session Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -23,10 +23,7 @@

use EasyWeChat\Foundation\Core\AbstractAPI;

/**
* Class Session.
*/
class Session extends AbstractAPI
class SessionClient extends AbstractAPI
{
const API_CREATE = 'https://api.weixin.qq.com/customservice/kfsession/create';
const API_CLOSE = 'https://api.weixin.qq.com/customservice/kfsession/close';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Device.php.
* OfficialAccount Device Client.
*
* @author soone <[email protected]>
* @copyright 2016 soone <[email protected]>
Expand All @@ -21,10 +21,7 @@
use EasyWeChat\Foundation\Core\AbstractAPI;
use EasyWeChat\OfficialAccount\Core\AccessToken;

/**
* Class Device.
*/
class Device extends AbstractAPI
class Client extends AbstractAPI
{
protected $deviceType;
protected $productId;
Expand All @@ -45,7 +42,7 @@ class Device extends AbstractAPI

public function __construct(AccessToken $accessToken, $config)
{
parent::setAccessToken($accessToken);
parent::__construct($accessToken);
$this->config = $config;
$this->deviceType = $this->config['device_type'];
$this->productId = $this->config['product_id'];
Expand Down
2 changes: 1 addition & 1 deletion src/OfficialAccount/Device/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['device'] = function ($pimple) {
return new Device($pimple['access_token'], $pimple['config']->get('device', []));
return new Client($pimple['access_token'], $pimple['config']->get('device', []));
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Js.php.
* OfficialAccount Js Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -27,10 +27,7 @@
use EasyWeChat\Support\Str;
use EasyWeChat\Support\Url as UrlHelper;

/**
* Class Js.
*/
class Js extends AbstractAPI
class Client extends AbstractAPI
{
/**
* Cache.
Expand Down Expand Up @@ -163,7 +160,7 @@ public function getSignature($ticket, $nonce, $timestamp, $url)
*
* @param string $url
*
* @return Js
* @return $this
*/
public function setUrl($url)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OfficialAccount/Js/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['js'] = function ($pimple) {
$js = new Js($pimple['access_token']);
$js = new Client($pimple['access_token']);
$js->setCache($pimple['cache']);

return $js;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Material.php.
* OfficialAccount Material Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -25,10 +25,7 @@
use EasyWeChat\Foundation\Core\AbstractAPI;
use EasyWeChat\OfficialAccount\Message\Article;

/**
* Class Material.
*/
class Material extends AbstractAPI
class Client extends AbstractAPI
{
/**
* Allow media type.
Expand Down
4 changes: 2 additions & 2 deletions src/OfficialAccount/Material/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['material'] = function ($pimple) {
return new Material($pimple['access_token']);
return new Client($pimple['access_token']);
};

$temporary = function ($pimple) {
return new Temporary($pimple['access_token']);
return new TemporaryClient($pimple['access_token']);
};

$pimple['material_temporary'] = $temporary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Temporary.php.
* OfficialAccount Temporary Material Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -25,10 +25,7 @@
use EasyWeChat\Foundation\Core\AbstractAPI;
use EasyWeChat\Support\File;

/**
* Class Temporary.
*/
class Temporary extends AbstractAPI
class TemporaryClient extends AbstractAPI
{
/**
* Allow media type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Menu.php.
* OfficialAccount Menu Client.
*
* @author overtrue <[email protected]>
* @copyright 2015 overtrue <[email protected]>
Expand All @@ -23,10 +23,7 @@

use EasyWeChat\Foundation\Core\AbstractAPI;

/**
* Class Menu.
*/
class Menu extends AbstractAPI
class Client extends AbstractAPI
{
const API_CREATE = 'https://api.weixin.qq.com/cgi-bin/menu/create';
const API_GET = 'https://api.weixin.qq.com/cgi-bin/menu/get';
Expand Down
2 changes: 1 addition & 1 deletion src/OfficialAccount/Menu/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ServiceProvider implements ServiceProviderInterface
public function register(Container $pimple)
{
$pimple['menu'] = function ($pimple) {
return new Menu($pimple['access_token']);
return new Client($pimple['access_token']);
};
}
}
Loading

0 comments on commit 62dd762

Please sign in to comment.