Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #2

Merged
merged 1 commit into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Credential.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Credential implements AccessTokenInterface
*
* @var string
*/
protected $baseUri = "https://api.weixin.qq.com/cgi-bin/";
protected $baseUri = 'https://api.weixin.qq.com/cgi-bin/';

/**
* Bootstap.
Expand Down Expand Up @@ -76,20 +76,20 @@ public function setAccessToken($token)
*/
public function getAccessToken()
{
if (! isset($this->accessToken)) {
if (!isset($this->accessToken)) {
if (is_null($this->appid) || is_null($this->appsecret)) {
throw new AccessTokenException("Appid or appsecret is null", 1);
throw new AccessTokenException('Appid or appsecret is null', 1);
}

$this->accessToken = Cache::remember('wechatAccessToken' . $this->appid, 118, function () {
$this->accessToken = Cache::remember('wechatAccessToken'.$this->appid, 118, function () {
$data = $this->get('token', [
'grant_type' => 'client_credential',
'appid' => $this->appid,
'secret' => $this->appsecret,
'appid' => $this->appid,
'secret' => $this->appsecret,
]);

if (! isset($data['access_token'])) {
throw new AccessTokenException('Error Get AccessToken:' . $data['errmsg'], $data['errcode'], $data);
if (!isset($data['access_token'])) {
throw new AccessTokenException('Error Get AccessToken:'.$data['errmsg'], $data['errcode'], $data);
}

return $data['access_token'];
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/AccessTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AccessTokenException extends Exception
public function __construct($message, $code, $raw = [])
{
parent::__construct($message, intval($code));

$this->raw = $raw;
}
}
6 changes: 3 additions & 3 deletions src/Exceptions/SendTemplateMessageException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class SendTemplateMessageException extends Exception
*
* @author yansongda <me@yansongda.cn>
*
* @param string $message
* @param string|int $code
* @param string $message
* @param string|int $code
* @param Yansongda\LaravelNotificationWechat\Contracts\AccessTokenInterface | null $credential
*/
public function __construct($message, $code, $raw = [], $credential = null)
{
parent::__construct($message, intval($code));

$this->raw = $raw;
$this->credential = $credential;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Wechat.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Wechat
*
* @var string
*/
protected $baseUri = "https://api.weixin.qq.com/cgi-bin/";
protected $baseUri = 'https://api.weixin.qq.com/cgi-bin/';

/**
* Bootstrap.
Expand Down
4 changes: 2 additions & 2 deletions src/WechatChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct(Wechat $wechat)
*
* @author yansongda <me@yansongda.cn>
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
*/
public function send($notifiable, Notification $notification)
{
Expand Down