From a6f9921246e7f58c39f296af27627815f9539c29 Mon Sep 17 00:00:00 2001 From: overtrue Date: Fri, 13 Apr 2018 22:09:53 +0800 Subject: [PATCH] Fix function name. --- src/EasySms.php | 11 ++++++++++- src/Gateways/QcloudGateway.php | 2 +- src/Gateways/TwilioGateway.php | 2 +- tests/Gateways/QcloudGatewayTest.php | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/EasySms.php b/src/EasySms.php index 6430111..efd0fac 100644 --- a/src/EasySms.php +++ b/src/EasySms.php @@ -76,6 +76,9 @@ class EasySms * @param array $gateways * * @return array + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException + * @throws \Overtrue\EasySms\Exceptions\NoGatewayAvailableException */ public function send($to, $message, array $gateways = []) { @@ -88,6 +91,8 @@ class EasySms * @param string|null $name * * @return \Overtrue\EasySms\Contracts\GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException */ public function gateway($name = null) { @@ -158,7 +163,7 @@ class EasySms * * @return string * - * @throws if no default gateway configured + * @throws \RuntimeException if no default gateway configured */ public function getDefaultGateway() { @@ -199,6 +204,8 @@ class EasySms * @throws \InvalidArgumentException * * @return GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException */ protected function createGateway($name) { @@ -223,6 +230,8 @@ class EasySms * @param array $config * * @return \Overtrue\EasySms\Contracts\GatewayInterface + * + * @throws \Overtrue\EasySms\Exceptions\InvalidArgumentException */ protected function makeGateway($gateway, $config) { diff --git a/src/Gateways/QcloudGateway.php b/src/Gateways/QcloudGateway.php index 519f3fc..8f13ae3 100644 --- a/src/Gateways/QcloudGateway.php +++ b/src/Gateways/QcloudGateway.php @@ -66,7 +66,7 @@ class QcloudGateway extends Gateway 'ext' => '', ]; - $random = str_random(10); + $random = substr(uniqid(), -10); $params['sig'] = $this->generateSign($params, $random); diff --git a/src/Gateways/TwilioGateway.php b/src/Gateways/TwilioGateway.php index 2c83e42..98e245b 100644 --- a/src/Gateways/TwilioGateway.php +++ b/src/Gateways/TwilioGateway.php @@ -11,11 +11,11 @@ namespace Overtrue\EasySms\Gateways; +use GuzzleHttp\Exception\ClientException; use Overtrue\EasySms\Contracts\MessageInterface; use Overtrue\EasySms\Exceptions\GatewayErrorException; use Overtrue\EasySms\Support\Config; use Overtrue\EasySms\Traits\HasHttpRequest; -use GuzzleHttp\Exception\ClientException; /** * Class TwilioGateway. diff --git a/tests/Gateways/QcloudGatewayTest.php b/tests/Gateways/QcloudGatewayTest.php index e4b484a..ddde9ff 100644 --- a/tests/Gateways/QcloudGatewayTest.php +++ b/tests/Gateways/QcloudGatewayTest.php @@ -21,7 +21,7 @@ class QcloudGatewayTest extends TestCase { public function testGetName() { - $this->assertSame('tencent', (new QcloudGateway([]))->getName()); + $this->assertSame('qcloud', (new QcloudGateway([]))->getName()); } public function testSend() -- GitLab