@@ -49,7 +49,7 @@ |
||
| 49 | 49 | 'exceptions' => false, |
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | - if (! is_null($template)) { |
|
| 52 | + if (!is_null($template)) { |
|
| 53 | 53 | $function = 'tpl_single_send'; |
| 54 | 54 | $data = []; |
| 55 | 55 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'mobile' => $to->getNumber(), |
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | - if (! empty($data)) { |
|
| 49 | + if (!empty($data)) { |
|
| 50 | 50 | $params['parameters'] = $data; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | // write request uri |
| 105 | 105 | $toSignStr = $method.' '.$path; |
| 106 | - if (! empty($query)) { |
|
| 106 | + if (!empty($query)) { |
|
| 107 | 107 | $toSignStr .= '?'.$query; |
| 108 | 108 | } |
| 109 | 109 | // write host and port |
| 110 | 110 | $toSignStr .= "\nHost: ".$host; |
| 111 | - if (! empty($port)) { |
|
| 111 | + if (!empty($port)) { |
|
| 112 | 112 | $toSignStr .= ':'.$port; |
| 113 | 113 | } |
| 114 | 114 | // write content type |
| 115 | - if (! empty($contentType)) { |
|
| 115 | + if (!empty($contentType)) { |
|
| 116 | 116 | $toSignStr .= "\nContent-Type: ".$contentType; |
| 117 | 117 | } |
| 118 | 118 | $toSignStr .= "\n\n"; |
| 119 | 119 | // write body |
| 120 | - if (! empty($body)) { |
|
| 120 | + if (!empty($body)) { |
|
| 121 | 121 | $toSignStr .= $body; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $data = $message->getData($this); |
| 42 | 42 | |
| 43 | - $signName = ! empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name'); |
|
| 43 | + $signName = !empty($data['sign_name']) ? $data['sign_name'] : $config->get('sign_name'); |
|
| 44 | 44 | |
| 45 | 45 | unset($data['sign_name']); |
| 46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'SignatureNonce' => uniqid('', true), |
| 54 | 54 | 'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'), |
| 55 | 55 | 'Version' => self::ENDPOINT_VERSION, |
| 56 | - 'To' => ! \is_null($to->getIDDCode()) ? (int) $to->getZeroPrefixedNumber() : $to->getNumber(), |
|
| 56 | + 'To' => !\is_null($to->getIDDCode()) ? (int) $to->getZeroPrefixedNumber() : $to->getNumber(), |
|
| 57 | 57 | 'Action' => self::ENDPOINT_ACTION, |
| 58 | 58 | 'From' => $signName, |
| 59 | 59 | 'TemplateCode' => $message->getTemplate($this), |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | try { |
| 93 | 93 | $result = $this->postJson($endpoint, $params); |
| 94 | 94 | |
| 95 | - if (! isset($result['code']) || $result['code'] !== self::SUCCESS_CODE) { |
|
| 95 | + if (!isset($result['code']) || $result['code'] !== self::SUCCESS_CODE) { |
|
| 96 | 96 | $code = isset($result['code']) ? $result['code'] : 0; |
| 97 | 97 | $error = isset($result['msg']) ? $result['msg'] : json_encode($result, JSON_UNESCAPED_UNICODE); |
| 98 | 98 | |
@@ -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'), |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $result = $this->postJson($this->buildEndpoint($config, $IDDCode), $params); |
| 74 | 74 | |
| 75 | - if (! isset($result['code']) || $result['code'] != '0') { |
|
| 75 | + if (!isset($result['code']) || $result['code'] != '0') { |
|
| 76 | 76 | throw new GatewayErrorException(json_encode($result, JSON_UNESCAPED_UNICODE), isset($result['code']) ? $result['code'] : 0, $result); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | $channel = $config->get('channel', self::CHANNEL_VALIDATE_CODE); |
| 110 | 110 | |
| 111 | - if (! in_array($channel, [self::CHANNEL_VALIDATE_CODE, self::CHANNEL_PROMOTION_CODE])) { |
|
| 111 | + if (!in_array($channel, [self::CHANNEL_VALIDATE_CODE, self::CHANNEL_PROMOTION_CODE])) { |
|
| 112 | 112 | throw new InvalidArgumentException('Invalid channel for ChuanglanGateway.'); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -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']); |