@@ -17,25 +17,25 @@ discard block |
||
17 | 17 | * @var array |
18 | 18 | */ |
19 | 19 | |
20 | - private $useCase = ['Transactional', 'Marketing', 'Transactional & Marketing']; |
|
20 | + private $useCase = [ 'Transactional', 'Marketing', 'Transactional & Marketing' ]; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var array |
24 | 24 | */ |
25 | 25 | |
26 | - private $channel = ['VOICE', 'SMS', 'WHATSAPP', 'EMAIL']; |
|
26 | + private $channel = [ 'VOICE', 'SMS', 'WHATSAPP', 'EMAIL' ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @var array |
30 | 30 | */ |
31 | 31 | |
32 | - private $tokenType = ['NUMERIC','ALPHANUMERIC']; |
|
32 | + private $tokenType = [ 'NUMERIC', 'ALPHANUMERIC' ]; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @var array |
36 | 36 | */ |
37 | 37 | |
38 | - private $smsRoute = ['non_dnd', 'dnd', 'international', 'PREMIUM_NG']; |
|
38 | + private $smsRoute = [ 'non_dnd', 'dnd', 'international', 'PREMIUM_NG' ]; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var string |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | private function setRequestOptions() |
103 | 103 | { |
104 | - $authBearer = 'Bearer '. $this->publicKey; |
|
104 | + $authBearer = 'Bearer '.$this->publicKey; |
|
105 | 105 | |
106 | 106 | $this->client = new Client( |
107 | 107 | [ |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | */ |
128 | 128 | |
129 | 129 | |
130 | - private function setHttpResponse($url, $method = null, $body = []) |
|
130 | + private function setHttpResponse($url, $method = null, $body = [ ]) |
|
131 | 131 | { |
132 | 132 | if (is_null($method)) { |
133 | 133 | throw new SendChampException("Empty method not allowed"); |
134 | 134 | } |
135 | 135 | |
136 | 136 | $this->response = $this->client->{strtolower($method)}( |
137 | - $this->baseUrl . $url, |
|
138 | - ["body" => json_encode($body)] |
|
137 | + $this->baseUrl.$url, |
|
138 | + [ "body" => json_encode($body) ] |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | return $this; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | */ |
165 | 165 | |
166 | 166 | public function createSmsSender(string $sender_name, string $use_case, |
167 | - string $sample_message){ |
|
167 | + string $sample_message) { |
|
168 | 168 | |
169 | - if(!in_array( $use_case ,$this->useCase )){ |
|
169 | + if (!in_array($use_case, $this->useCase)) { |
|
170 | 170 | |
171 | 171 | throw new SendChampException("Invalid Use case"); |
172 | 172 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @return array |
201 | 201 | */ |
202 | 202 | |
203 | - public function sendSms(string $message, string $sender_name, array $numbers, string $route = ""){ |
|
203 | + public function sendSms(string $message, string $sender_name, array $numbers, string $route = "") { |
|
204 | 204 | |
205 | - if(!empty($route) && !in_array( $route ,$this->smsRoute )){ |
|
205 | + if (!empty($route) && !in_array($route, $this->smsRoute)) { |
|
206 | 206 | |
207 | 207 | throw new SendChampException("Invalid sms route"); |
208 | 208 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * @return array |
228 | 228 | */ |
229 | 229 | |
230 | - public function fetchSmsStatus(string $sms_id){ |
|
230 | + public function fetchSmsStatus(string $sms_id) { |
|
231 | 231 | |
232 | - return $this->setRequestOptions()->setHttpResponse('/sms/'.$sms_id.'/report', 'GET', [])->getResponse(); |
|
232 | + return $this->setRequestOptions()->setHttpResponse('/sms/'.$sms_id.'/report', 'GET', [ ])->getResponse(); |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | |
249 | 249 | |
250 | - public function sendVoice(string $message, string $sender_name, string $number){ |
|
250 | + public function sendVoice(string $message, string $sender_name, string $number) { |
|
251 | 251 | |
252 | 252 | $data = [ |
253 | 253 | 'customer_mobile_number' => $number, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | |
278 | 278 | public function sendWhatsappOtp(string $template_code, string $message, |
279 | - string $sender_number, string $recipient){ |
|
279 | + string $sender_number, string $recipient) { |
|
280 | 280 | |
281 | 281 | $data = [ |
282 | 282 | 'recipient' => $recipient, |
@@ -310,15 +310,15 @@ discard block |
||
310 | 310 | */ |
311 | 311 | |
312 | 312 | public function sendOtp(string $channel, string $token_type, int $token_length, |
313 | - int $expiry_day, string $customer_email, string $customer_mobile_number, array $meta_data, string $sender){ |
|
313 | + int $expiry_day, string $customer_email, string $customer_mobile_number, array $meta_data, string $sender) { |
|
314 | 314 | |
315 | - if(!in_array($token_type, $this->tokenType)){ |
|
315 | + if (!in_array($token_type, $this->tokenType)) { |
|
316 | 316 | |
317 | 317 | throw new SendChampException("Invalid token type"); |
318 | 318 | |
319 | 319 | } |
320 | 320 | |
321 | - if(!in_array($channel, $this->channel)){ |
|
321 | + if (!in_array($channel, $this->channel)) { |
|
322 | 322 | |
323 | 323 | throw new SendChampException("Invalid channel"); |
324 | 324 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | |
353 | 353 | |
354 | - public function confirmOtp(string $reference, string $otp){ |
|
354 | + public function confirmOtp(string $reference, string $otp) { |
|
355 | 355 | |
356 | 356 | $data = [ |
357 | 357 | 'verification_reference' => $reference, |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | * @return array |
369 | 369 | */ |
370 | 370 | |
371 | - public function getContactList(){ |
|
371 | + public function getContactList() { |
|
372 | 372 | |
373 | - return $this->setRequestOptions()->setHttpResponse('/contacts', 'GET', [])->getResponse(); |
|
373 | + return $this->setRequestOptions()->setHttpResponse('/contacts', 'GET', [ ])->getResponse(); |
|
374 | 374 | |
375 | 375 | } |
376 | 376 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @return array |
386 | 386 | */ |
387 | 387 | |
388 | - public function createOrUpdateContact(string $lastname, string $firstname, string $phone, string $email, string $reference){ |
|
388 | + public function createOrUpdateContact(string $lastname, string $firstname, string $phone, string $email, string $reference) { |
|
389 | 389 | |
390 | 390 | $data = [ |
391 | 391 | |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | * @return array |
409 | 409 | */ |
410 | 410 | |
411 | - public function deleteContact(string $id){ |
|
411 | + public function deleteContact(string $id) { |
|
412 | 412 | |
413 | 413 | |
414 | - return $this->setRequestOptions()->setHttpResponse('/contact/'.$id.'/delete', 'POST', [])->getResponse(); |
|
414 | + return $this->setRequestOptions()->setHttpResponse('/contact/'.$id.'/delete', 'POST', [ ])->getResponse(); |
|
415 | 415 | |
416 | 416 | } |
417 | 417 | |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | * @return array |
424 | 424 | */ |
425 | 425 | |
426 | - public function getWalletReport(){ |
|
426 | + public function getWalletReport() { |
|
427 | 427 | |
428 | - return $this->setRequestOptions()->setHttpResponse('/report/wallet/list', 'GET', [])->getResponse(); |
|
428 | + return $this->setRequestOptions()->setHttpResponse('/report/wallet/list', 'GET', [ ])->getResponse(); |
|
429 | 429 | |
430 | 430 | } |
431 | 431 |