@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | 'sms_type' => 'normal', |
| 57 | 57 | 'sms_free_sign_name' => $config->get('sign_name'), |
| 58 | 58 | 'sms_param' => json_encode($message->getData($this)), |
| 59 | - 'rec_num' => ! \is_null($to->getIDDCode()) ? strval($to->getZeroPrefixedNumber()) : $to->getNumber(), |
|
| 59 | + 'rec_num' => !\is_null($to->getIDDCode()) ? strval($to->getZeroPrefixedNumber()) : $to->getNumber(), |
|
| 60 | 60 | 'sms_template_code' => $message->getTemplate($this), |
| 61 | 61 | ]; |
| 62 | 62 | $urlParams['sign'] = $this->generateSign(array_merge($params, $urlParams)); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $stringToBeSigned = $this->config->get('app_secret_key'); |
| 91 | 91 | foreach ($params as $k => $v) { |
| 92 | - if (! is_array($v) && substr($v, 0, 1) != '@') { |
|
| 92 | + if (!is_array($v) && substr($v, 0, 1) != '@') { |
|
| 93 | 93 | $stringToBeSigned .= "$k$v"; |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) |
| 57 | 57 | { |
| 58 | - $IDDCode = ! empty($to->getIDDCode()) ? $to->getIDDCode() : 86; |
|
| 58 | + $IDDCode = !empty($to->getIDDCode()) ? $to->getIDDCode() : 86; |
|
| 59 | 59 | |
| 60 | 60 | $params = [ |
| 61 | 61 | 'account' => $config->get('account'), |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $result = $this->postJson($this->buildEndpoint($config, $IDDCode), $params); |
| 81 | 81 | |
| 82 | - if (! isset($result['code']) || $result['code'] != '0') { |
|
| 82 | + if (!isset($result['code']) || $result['code'] != '0') { |
|
| 83 | 83 | throw new GatewayErrorException(json_encode($result, JSON_UNESCAPED_UNICODE), isset($result['code']) ? $result['code'] : 0, $result); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | $channel = $config->get('channel', self::CHANNEL_NORMAL_CODE); |
| 117 | 117 | |
| 118 | - if (! in_array($channel, [self::CHANNEL_NORMAL_CODE, self::CHANNEL_VARIABLE_CODE])) { |
|
| 118 | + if (!in_array($channel, [self::CHANNEL_NORMAL_CODE, self::CHANNEL_VARIABLE_CODE])) { |
|
| 119 | 119 | throw new InvalidArgumentException('Invalid channel for ChuanglanGateway.'); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | ], |
| 64 | 64 | 'form_params' => $params, |
| 65 | 65 | ]); |
| 66 | - if (in_array($result['status'], $this->errorStatuses) || ! is_null($result['error_code'])) { |
|
| 66 | + if (in_array($result['status'], $this->errorStatuses) || !is_null($result['error_code'])) { |
|
| 67 | 67 | throw new GatewayErrorException($result['message'], $result['error_code'], $result); |
| 68 | 68 | } |
| 69 | 69 | } catch (ClientException $e) { |
@@ -51,12 +51,12 @@ |
||
| 51 | 51 | 'template' => $message->getTemplate($this), |
| 52 | 52 | 'contentVar' => $message->getData($this), |
| 53 | 53 | ]; |
| 54 | - if (! empty($params['contentVar']['custom'])) { |
|
| 54 | + if (!empty($params['contentVar']['custom'])) { |
|
| 55 | 55 | // 用户自定义参数,格式为字符串,状态回调时会回传该值 |
| 56 | 56 | $params['custom'] = $params['contentVar']['custom']; |
| 57 | 57 | unset($params['contentVar']['custom']); |
| 58 | 58 | } |
| 59 | - if (! empty($params['contentVar']['userExtId'])) { |
|
| 59 | + if (!empty($params['contentVar']['userExtId'])) { |
|
| 60 | 60 | // 通道自定义扩展码,上行回调时会回传该值,其格式为纯数字串。默认为不开通,请求时无需设置该参数。如需开通请联系客服申请 |
| 61 | 61 | $params['userExtId'] = $params['contentVar']['userExtId']; |
| 62 | 62 | unset($params['contentVar']['userExtId']); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public const ENDPOINT_FORMAT = 'json'; |
| 37 | 37 | |
| 38 | - public const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 |
|
| 38 | + public const ENDPOINT_REGION = '86'; // 中国区,目前只支持此国别 |
|
| 39 | 39 | |
| 40 | 40 | public const SUCCESS_CODE = 200; |
| 41 | 41 | |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | break; |
| 69 | 69 | case 'verifyCode': |
| 70 | - if (! array_key_exists('code', $data) |
|
| 71 | - or ! array_key_exists('sessionId', $data)) { |
|
| 70 | + if (!array_key_exists('code', $data) |
|
| 71 | + or !array_key_exists('sessionId', $data)) { |
|
| 72 | 72 | throw new GatewayErrorException('"code" or "sessionId" is not set', 0); |
| 73 | 73 | } |
| 74 | 74 | $params = [ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | try { |
| 72 | 72 | $result = $this->post($endpoint, $params, $headers); |
| 73 | 73 | |
| 74 | - if (! isset($result['code']) || $result['code'] !== self::SUCCESS_CODE) { |
|
| 74 | + if (!isset($result['code']) || $result['code'] !== self::SUCCESS_CODE) { |
|
| 75 | 75 | $code = isset($result['code']) ? $result['code'] : 0; |
| 76 | 76 | $error = isset($result['msg']) ? $result['msg'] : json_encode($result, JSON_UNESCAPED_UNICODE); |
| 77 | 77 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $data = $message->getData($this); |
| 140 | 140 | |
| 141 | - if (! array_key_exists('code', $data)) { |
|
| 141 | + if (!array_key_exists('code', $data)) { |
|
| 142 | 142 | throw new GatewayErrorException('"code" cannot be empty', 0); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config) |
| 20 | 20 | { |
| 21 | - if (! $config->get('key')) { |
|
| 21 | + if (!$config->get('key')) { |
|
| 22 | 22 | throw new GatewayErrorException('key not found', -2, []); |
| 23 | 23 | } |
| 24 | 24 | $params = [ |
@@ -60,23 +60,23 @@ discard block |
||
| 60 | 60 | $data = $message->getData($this); |
| 61 | 61 | $params = [ |
| 62 | 62 | 'Action' => self::ENDPOINT_Action, |
| 63 | - 'SigContent' => ! empty($data['sig_content']) ? $data['sig_content'] : $config->get('sig_content', ''), |
|
| 63 | + 'SigContent' => !empty($data['sig_content']) ? $data['sig_content'] : $config->get('sig_content', ''), |
|
| 64 | 64 | 'TemplateId' => $message->getTemplate($this), |
| 65 | 65 | 'PublicKey' => $config->get('public_key'), |
| 66 | 66 | ]; |
| 67 | 67 | $code = isset($data['code']) ? $data['code'] : ''; |
| 68 | - if (is_array($code) && ! empty($code)) { |
|
| 68 | + if (is_array($code) && !empty($code)) { |
|
| 69 | 69 | foreach ($code as $key => $value) { |
| 70 | 70 | $params['TemplateParams.'.$key] = $value; |
| 71 | 71 | } |
| 72 | 72 | } else { |
| 73 | - if (! empty($code) || ! is_null($code)) { |
|
| 73 | + if (!empty($code) || !is_null($code)) { |
|
| 74 | 74 | $params['TemplateParams.0'] = $code; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $mobiles = isset($data['mobiles']) ? $data['mobiles'] : ''; |
| 79 | - if (! empty($mobiles) && ! is_null($mobiles)) { |
|
| 79 | + if (!empty($mobiles) && !is_null($mobiles)) { |
|
| 80 | 80 | if (is_array($mobiles)) { |
| 81 | 81 | foreach ($mobiles as $key => $value) { |
| 82 | 82 | $params['PhoneNumbers.'.$key] = $value; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $params['PhoneNumbers.0'] = $to->getNumber(); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (! is_null($config->get('project_id')) && ! empty($config->get('project_id'))) { |
|
| 91 | + if (!is_null($config->get('project_id')) && !empty($config->get('project_id'))) { |
|
| 92 | 92 | $params['ProjectId'] = $config->get('project_id'); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $data = $message->getData($this); |
| 50 | 50 | |
| 51 | - $signName = ! empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name', ''); |
|
| 51 | + $signName = !empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name', ''); |
|
| 52 | 52 | |
| 53 | 53 | unset($data['sign_name']); |
| 54 | 54 | |
| 55 | - $phone = ! \is_null($to->getIDDCode()) ? strval($to->getUniversalNumber()) : $to->getNumber(); |
|
| 55 | + $phone = !\is_null($to->getIDDCode()) ? strval($to->getUniversalNumber()) : $to->getNumber(); |
|
| 56 | 56 | $params = [ |
| 57 | 57 | 'PhoneNumberSet' => [ |
| 58 | 58 | $phone, |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | 'json' => $params, |
| 81 | 81 | ]); |
| 82 | 82 | |
| 83 | - if (! empty($result['Response']['Error']['Code'])) { |
|
| 83 | + if (!empty($result['Response']['Error']['Code'])) { |
|
| 84 | 84 | throw new GatewayErrorException($result['Response']['Error']['Message'], 400, $result); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if (! empty($result['Response']['SendStatusSet'])) { |
|
| 87 | + if (!empty($result['Response']['SendStatusSet'])) { |
|
| 88 | 88 | foreach ($result['Response']['SendStatusSet'] as $group) { |
| 89 | 89 | if ($group['Code'] != 'Ok') { |
| 90 | 90 | throw new GatewayErrorException($group['Message'], 400, $result); |