@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | private $responseString; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @param bool $status |
|
| 23 | - * @param string $responseString |
|
| 24 | - */ |
|
| 22 | + * @param bool $status |
|
| 23 | + * @param string $responseString |
|
| 24 | + */ |
|
| 25 | 25 | public function __construct($status, $responseString) |
| 26 | 26 | { |
| 27 | 27 | $this->status = $status; |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Get the response object as a string |
|
| 33 | - * |
|
| 34 | - * @return string |
|
| 35 | - */ |
|
| 32 | + * Get the response object as a string |
|
| 33 | + * |
|
| 34 | + * @return string |
|
| 35 | + */ |
|
| 36 | 36 | public function __toString() |
| 37 | 37 | { |
| 38 | 38 | return json_encode([ |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | throw new Exception($response->getResponseString(), 500); |
| 157 | 157 | } |
| 158 | 158 | } catch (Exception $e) { |
| 159 | - Log::error('Curl error response: '.$e->getMessage()); |
|
| 159 | + Log::error('Curl error response: ' . $e->getMessage()); |
|
| 160 | 160 | |
| 161 | 161 | throw $e; |
| 162 | 162 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | 'timeout' => 30, |
| 188 | 188 | ]; |
| 189 | 189 | |
| 190 | - switch(get_class($this->provider)) { |
|
| 190 | + switch (get_class($this->provider)) { |
|
| 191 | 191 | case self::PROVIDER_GRAMEENPHONE: |
| 192 | 192 | case self::PROVIDER_NOVOCOM: |
| 193 | 193 | $options += [ |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | 'httpheader' => [ |
| 203 | 203 | 'Content-Type: application/json', |
| 204 | 204 | 'Accept: application/json', |
| 205 | - 'user_id:'.$data['user_id'], |
|
| 206 | - 'password:'.$data['password'], |
|
| 205 | + 'user_id:' . $data['user_id'], |
|
| 206 | + 'password:' . $data['password'], |
|
| 207 | 207 | ], |
| 208 | 208 | 'post' => 1, |
| 209 | 209 | 'postfields' => json_encode($data), |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if ($this->provider instanceof NeedsAuthenticationInterface) { |
| 221 | - $options['httpheader'][] = 'Authorization: Bearer '.$this->provider->getAccessToken(); |
|
| 221 | + $options['httpheader'][] = 'Authorization: Bearer ' . $this->provider->getAccessToken(); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | return $options; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | isset($options['returntransfer']) || $options['returntransfer'] = true; |
| 231 | 231 | |
| 232 | 232 | foreach ($options as $key => $value) { |
| 233 | - $option = 'CURLOPT_'.strtoupper($key); |
|
| 233 | + $option = 'CURLOPT_' . strtoupper($key); |
|
| 234 | 234 | $curlOptions[constant($option)] = $value; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $response = curl_exec($ch); |
| 242 | 242 | |
| 243 | 243 | if ($response != true) { |
| 244 | - $eMsg = 'cURL Error # '.curl_errno($ch).' | cURL Error Message: '.curl_error($ch); |
|
| 244 | + $eMsg = 'cURL Error # ' . curl_errno($ch) . ' | cURL Error Message: ' . curl_error($ch); |
|
| 245 | 245 | |
| 246 | 246 | curl_close($ch); |
| 247 | 247 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | public function boot() |
| 10 | 10 | { |
| 11 | 11 | $this->package('sarahman/sms-service-with-bd-providers', null, __DIR__); |
| 12 | - $this->package('sarahman/laravel-http-request-api-log', null, __DIR__ .'/../../laravel-http-request-api-log/src'); |
|
| 12 | + $this->package('sarahman/laravel-http-request-api-log', null, __DIR__ . '/../../laravel-http-request-api-log/src'); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function register() |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | private function loadConfigFromFile() |
| 60 | 60 | { |
| 61 | 61 | $this->configName = !is_null($this->configName) ? $this->configName : get_class($this); |
| 62 | - $this->config = Config::get('sms-service-with-bd-providers::config.providers.'.$this->configName); |
|
| 62 | + $this->config = Config::get('sms-service-with-bd-providers::config.providers.' . $this->configName); |
|
| 63 | 63 | |
| 64 | 64 | $this->extractUrlFromConfigAndSet(); |
| 65 | 65 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | return []; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - $recipient = '0'.$matches[3]; |
|
| 20 | + $recipient = '0' . $matches[3]; |
|
| 21 | 21 | |
| 22 | 22 | return [ |
| 23 | 23 | 'type' => $this->config['type'], |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | return []; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $recipient = '880'.$matches[3]; |
|
| 28 | + $recipient = '880' . $matches[3]; |
|
| 29 | 29 | $clientRefId = !array_key_exists('id', $params) ? uniqid() : $params['id']; |
| 30 | 30 | |
| 31 | 31 | return [ |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | return []; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - $recipient = '880'.$matches[3]; |
|
| 20 | + $recipient = '880' . $matches[3]; |
|
| 21 | 21 | |
| 22 | 22 | return [ |
| 23 | 23 | 'contacts' => $recipient, |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function getUrl() |
| 27 | 27 | { |
| 28 | - return parent::getUrl().'/sendsms'; |
|
| 28 | + return parent::getUrl() . '/sendsms'; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function getUsername() |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | return []; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $recipient = '880'.$matches[3]; |
|
| 42 | + $recipient = '880' . $matches[3]; |
|
| 43 | 43 | |
| 44 | 44 | if (!array_key_exists('coding', $this->config) || $this->config['coding'] != 3) { |
| 45 | 45 | $message = preg_replace('/[^a-zA-Z0-9\.@!?&\-,%\(\):\"]/', ' ', $message); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | return Cache::get($cacheKey); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $api = $this->url.'/api/sendsms/token?action=generate'; |
|
| 81 | + $api = $this->url . '/api/sendsms/token?action=generate'; |
|
| 82 | 82 | $request = [ |
| 83 | 83 | 'headers' => [ |
| 84 | - 'Authorization' => ['Basic '.base64_encode($this->config['username'].':'.$this->config['password'])], |
|
| 84 | + 'Authorization' => ['Basic ' . base64_encode($this->config['username'] . ':' . $this->config['password'])], |
|
| 85 | 85 | ], |
| 86 | 86 | ]; |
| 87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | if (200 === $response->getStatusCode()) { |
| 95 | 95 | $responseData = $this->parseJson($response); |
| 96 | - $api = $this->url.'/api/sendsms/token?action=enable&token=all'; |
|
| 96 | + $api = $this->url . '/api/sendsms/token?action=enable&token=all'; |
|
| 97 | 97 | $request['form_params'] = ['token' => $responseData['token']]; |
| 98 | 98 | $response = $this->makeRequestWithHandlingException($client, $method = 'post', $api, $request); |
| 99 | 99 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | return []; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - $recipient = '880'.$matches[3]; |
|
| 20 | + $recipient = '880' . $matches[3]; |
|
| 21 | 21 | |
| 22 | 22 | return [ |
| 23 | 23 | 'receiver' => $recipient, |