Skip to content

Commit

Permalink
Apply fixes from StyleCI (overtrue#79)
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
overtrue authored Jan 18, 2018
1 parent 64aab0a commit 250be87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Gateways/QcloudGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ public function send($to, MessageInterface $message, Config $config)

$params['sig'] = $this->generateSign($params, $random);

$url = self::ENDPOINT_URL . self::ENDPOINT_METHOD . '?sdkappid=' . $config->get('sdk_app_id') . '&random=' . $random;
$url = self::ENDPOINT_URL.self::ENDPOINT_METHOD.'?sdkappid='.$config->get('sdk_app_id').'&random='.$random;

$result = $this->request('post', $url, [
'headers' => ['Accept' => 'application/json'],
'json' => $params,
]);

if ($result['result'] != 0) {
if (0 != $result['result']) {
throw new GatewayErrorException($result['errmsg'], $result['result'], $result);
}

Expand All @@ -87,7 +87,7 @@ public function send($to, MessageInterface $message, Config $config)
/**
* Generate Sign.
*
* @param array $params
* @param array $params
* @param string $random
*
* @return string
Expand All @@ -96,7 +96,7 @@ protected function generateSign($params, $random)
{
ksort($params);

return hash("sha256", sprintf('appkey=%s&random=%s&time=%s&mobile=%s',
return hash('sha256', sprintf('appkey=%s&random=%s&time=%s&mobile=%s',
$this->config->get('app_key'),
$random,
$params['time'],
Expand Down
6 changes: 3 additions & 3 deletions tests/Gateways/QcloudGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public function testSend()
'errmsg' => 'OK',
'ext' => '',
'sid' => 3310228982,
'fee' => 1
'fee' => 1,
], [
'result' => 1001,
'errmsg' => 'sig校验失败',
])->twice();

$message = new Message(['data' => [ 'type' => 0 ], 'content' => 'This is a test message.']);
$message = new Message(['data' => ['type' => 0], 'content' => 'This is a test message.']);

$config = new Config($config);

Expand All @@ -65,7 +65,7 @@ public function testSend()
'errmsg' => 'OK',
'ext' => '',
'sid' => 3310228982,
'fee' => 1
'fee' => 1,
], $gateway->send(18888888888, $message, $config));

$this->expectException(GatewayErrorException::class);
Expand Down

0 comments on commit 250be87

Please sign in to comment.