@@ -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); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $isSuccessful = true; |
| 58 | 58 | |
| 59 | 59 | break; |
| 60 | - } catch (\Exception|\Throwable $e) { |
|
| 60 | + } catch (\Exception | \Throwable $e) { |
|
| 61 | 61 | $results[$gateway] = [ |
| 62 | 62 | 'gateway' => $gateway, |
| 63 | 63 | 'status' => self::STATUS_FAILURE, |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! $isSuccessful) { |
|
| 70 | + if (!$isSuccessful) { |
|
| 71 | 71 | throw new NoGatewayAvailableException($results); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -41,12 +41,12 @@ |
||
| 41 | 41 | return $config[$key]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (! str_contains($key, '.')) { |
|
| 44 | + if (!str_contains($key, '.')) { |
|
| 45 | 45 | return $default; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | foreach (explode('.', $key) as $segment) { |
| 49 | - if (! is_array($config) || ! array_key_exists($segment, $config)) { |
|
| 49 | + if (!is_array($config) || !array_key_exists($segment, $config)) { |
|
| 50 | 50 | return $default; |
| 51 | 51 | } |
| 52 | 52 | $config = $config[$segment]; |