@@ -81,7 +81,7 @@ |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function remove() { |
| 84 | - foreach(self::expected as $key) { |
|
| 84 | + foreach (self::expected as $key) { |
|
| 85 | 85 | $this->config->deleteAppValue(Application::APP_ID, $key); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | public function send(string $identifier, string $message) { |
| 74 | 74 | $config = $this->getConfig(); |
| 75 | 75 | $endpoint = $config->getEndpoint(); |
| 76 | - $this->attrs['user'] = $config->getUsername(); |
|
| 77 | - $this->attrs['password'] = $config->getPassword(); |
|
| 78 | - $this->attrs['endpoint'] = $config->getEndpoint(); |
|
| 79 | - if (!isset($this->endpoints[$endpoint])) { |
|
| 76 | + $this->attrs[ 'user' ] = $config->getUsername(); |
|
| 77 | + $this->attrs[ 'password' ] = $config->getPassword(); |
|
| 78 | + $this->attrs[ 'endpoint' ] = $config->getEndpoint(); |
|
| 79 | + if (!isset($this->endpoints[ $endpoint ])) { |
|
| 80 | 80 | throw new InvalidSmsProviderException("Endpoint $endpoint not found"); |
| 81 | 81 | } |
| 82 | - $this->attrs['endpoint'] = $this->endpoints[$endpoint]; |
|
| 82 | + $this->attrs[ 'endpoint' ] = $this->endpoints[ $endpoint ]; |
|
| 83 | 83 | |
| 84 | 84 | $content = [ |
| 85 | 85 | "message"=> $message, |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $body = json_encode($content); |
| 89 | 89 | |
| 90 | 90 | $response = $this->client->post( |
| 91 | - $this->attrs['endpoint']."/sms",[ |
|
| 91 | + $this->attrs[ 'endpoint' ]."/sms", [ |
|
| 92 | 92 | 'json' => $content, |
| 93 | - 'auth' => [$this->attrs['user'],$this->attrs['password']] |
|
| 93 | + 'auth' => [ $this->attrs[ 'user' ], $this->attrs[ 'password' ] ] |
|
| 94 | 94 | ] |
| 95 | 95 | ); |
| 96 | - $resultPostJob = json_decode($response->getBody(),true); |
|
| 96 | + $resultPostJob = json_decode($response->getBody(), true); |
|
| 97 | 97 | |
| 98 | - if (strlen($resultPostJob["messageId"]) === 0) { |
|
| 98 | + if (strlen($resultPostJob[ "messageId" ]) === 0) { |
|
| 99 | 99 | throw new SmsTransmissionException("Bad receiver $identifier"); |
| 100 | 100 | } |
| 101 | 101 | } |