@@ -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_NG', 'DND_NGN','PREMIUM_NG']; |
|
| 38 | + private $smsRoute = [ 'NON_DND_NG', 'DND_NGN', '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, $body = []) |
|
| 130 | + private function setHttpResponse($url, $method, $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 | |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | * @return array |
| 200 | 200 | */ |
| 201 | 201 | |
| 202 | - public function sendSms(string $message, string $sender_name, array $numbers, string $route = ""){ |
|
| 202 | + public function sendSms(string $message, string $sender_name, array $numbers, string $route = "") { |
|
| 203 | 203 | |
| 204 | - if(!empty($route) && !in_array( $route ,$this->smsRoute )){ |
|
| 204 | + if (!empty($route) && !in_array($route, $this->smsRoute)) { |
|
| 205 | 205 | |
| 206 | 206 | throw new SendChampException("Invalid sms route"); |
| 207 | 207 | |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | * @return array |
| 227 | 227 | */ |
| 228 | 228 | |
| 229 | - public function fetchSmsStatus(string $sms_id){ |
|
| 229 | + public function fetchSmsStatus(string $sms_id) { |
|
| 230 | 230 | |
| 231 | - return $this->setRequestOptions()->setHttpResponse('/sms/'.$sms_id.'/report', 'GET', [])->getResponse(); |
|
| 231 | + return $this->setRequestOptions()->setHttpResponse('/sms/'.$sms_id.'/report', 'GET', [ ])->getResponse(); |
|
| 232 | 232 | |
| 233 | 233 | } |
| 234 | 234 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | |
| 248 | 248 | |
| 249 | - public function sendVoice(string $message, string $sender_name, string $number){ |
|
| 249 | + public function sendVoice(string $message, string $sender_name, string $number) { |
|
| 250 | 250 | |
| 251 | 251 | $data = [ |
| 252 | 252 | 'customer_mobile_number' => $number, |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | |
| 277 | 277 | public function sendWhatsappOtp(string $template_code, string $message, |
| 278 | - string $sender_number, string $recipient){ |
|
| 278 | + string $sender_number, string $recipient) { |
|
| 279 | 279 | |
| 280 | 280 | $data = [ |
| 281 | 281 | 'recipient' => $recipient, |
@@ -309,15 +309,15 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | |
| 311 | 311 | public function sendOtp(string $channel, string $token_type, int $token_length, |
| 312 | - int $expiry_day, string $customer_email, string $customer_mobile_number, array $meta_data, string $sender){ |
|
| 312 | + int $expiry_day, string $customer_email, string $customer_mobile_number, array $meta_data, string $sender) { |
|
| 313 | 313 | |
| 314 | - if(!in_array($token_type, $this->tokenType)){ |
|
| 314 | + if (!in_array($token_type, $this->tokenType)) { |
|
| 315 | 315 | |
| 316 | 316 | throw new SendChampException("Invalid token type"); |
| 317 | 317 | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if(!in_array($channel, $this->channel)){ |
|
| 320 | + if (!in_array($channel, $this->channel)) { |
|
| 321 | 321 | |
| 322 | 322 | throw new SendChampException("Invalid channel"); |
| 323 | 323 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | |
| 352 | 352 | |
| 353 | - public function confirmOtp(string $reference, string $otp){ |
|
| 353 | + public function confirmOtp(string $reference, string $otp) { |
|
| 354 | 354 | |
| 355 | 355 | $data = [ |
| 356 | 356 | 'verification_reference' => $reference, |
@@ -367,9 +367,9 @@ discard block |
||
| 367 | 367 | * @return array |
| 368 | 368 | */ |
| 369 | 369 | |
| 370 | - public function getContactList(){ |
|
| 370 | + public function getContactList() { |
|
| 371 | 371 | |
| 372 | - return $this->setRequestOptions()->setHttpResponse('/contacts', 'GET', [])->getResponse(); |
|
| 372 | + return $this->setRequestOptions()->setHttpResponse('/contacts', 'GET', [ ])->getResponse(); |
|
| 373 | 373 | |
| 374 | 374 | } |
| 375 | 375 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @return array |
| 385 | 385 | */ |
| 386 | 386 | |
| 387 | - public function createOrUpdateContact(string $lastname, string $firstname, string $phone, string $email, string $reference){ |
|
| 387 | + public function createOrUpdateContact(string $lastname, string $firstname, string $phone, string $email, string $reference) { |
|
| 388 | 388 | |
| 389 | 389 | $data = [ |
| 390 | 390 | |
@@ -407,10 +407,10 @@ discard block |
||
| 407 | 407 | * @return array |
| 408 | 408 | */ |
| 409 | 409 | |
| 410 | - public function deleteContact(string $id){ |
|
| 410 | + public function deleteContact(string $id) { |
|
| 411 | 411 | |
| 412 | 412 | |
| 413 | - return $this->setRequestOptions()->setHttpResponse('/contact/'.$id.'/delete', 'POST', [])->getResponse(); |
|
| 413 | + return $this->setRequestOptions()->setHttpResponse('/contact/'.$id.'/delete', 'POST', [ ])->getResponse(); |
|
| 414 | 414 | |
| 415 | 415 | } |
| 416 | 416 | |
@@ -422,9 +422,9 @@ discard block |
||
| 422 | 422 | * @return array |
| 423 | 423 | */ |
| 424 | 424 | |
| 425 | - public function getWalletReport(){ |
|
| 425 | + public function getWalletReport() { |
|
| 426 | 426 | |
| 427 | - return $this->setRequestOptions()->setHttpResponse('/report/wallet/list', 'GET', [])->getResponse(); |
|
| 427 | + return $this->setRequestOptions()->setHttpResponse('/report/wallet/list', 'GET', [ ])->getResponse(); |
|
| 428 | 428 | |
| 429 | 429 | } |
| 430 | 430 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function register() |
| 30 | 30 | { |
| 31 | 31 | // |
| 32 | - $this->app->bind('laravel-sendchamp', function () { |
|
| 32 | + $this->app->bind('laravel-sendchamp', function() { |
|
| 33 | 33 | |
| 34 | 34 | return new SendChamp; |
| 35 | 35 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function provides() |
| 59 | 59 | { |
| 60 | - return ['laravel-sendchamp']; |
|
| 60 | + return [ 'laravel-sendchamp' ]; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |