@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function setBaseUrl() |
64 | 64 | { |
65 | - if(Config::get('payant.mode') == 'LIVE') |
|
65 | + if (Config::get('payant.mode') == 'LIVE') |
|
66 | 66 | { |
67 | 67 | $this->base_uri = "https://api.payant.ng"; |
68 | 68 | } |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | */ |
83 | 83 | private function setRequestOptions() |
84 | 84 | { |
85 | - $authorization_string = 'Bearer '. $this->private_key; |
|
85 | + $authorization_string = 'Bearer '.$this->private_key; |
|
86 | 86 | |
87 | 87 | //Set up Guzzle |
88 | - $this->client = new Client( [ |
|
88 | + $this->client = new Client([ |
|
89 | 89 | 'base_uri' => $this->base_uri, |
90 | 90 | 'protocols' => ['https'], |
91 | 91 | 'headers' => [ |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * [getBanks Get Banks and their ids (Nigeria)] |
102 | 102 | * @return object [list of banks and their respective bank_ids] |
103 | 103 | */ |
104 | - public function getBanks(){ |
|
104 | + public function getBanks() { |
|
105 | 105 | return $this->sendRequest('get', '/banks'); |
106 | 106 | } |
107 | 107 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | * Required fields - 'settlement_bank', 'account_number' |
114 | 114 | * @return object |
115 | 115 | */ |
116 | - public function resolveAccount( array $client_data){ |
|
116 | + public function resolveAccount(array $client_data) { |
|
117 | 117 | // Mandatory fields |
118 | 118 | $required_values = ['settlement_bank', 'account_number']; |
119 | 119 | |
120 | - if(!array_keys_exist($client_data, $required_values)){ |
|
120 | + if (!array_keys_exist($client_data, $required_values)) { |
|
121 | 121 | throw new RequiredValuesMissing("Missing required values :("); |
122 | 122 | } |
123 | 123 | |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * Optional - 'address', 'company_name', 'type', 'settlement_bank', 'account_number' |
137 | 137 | * @return object |
138 | 138 | */ |
139 | - public function addClient( array $client_data){ |
|
139 | + public function addClient(array $client_data) { |
|
140 | 140 | // Mandatory fields |
141 | 141 | $required_values = ['first_name', 'last_name', 'email', 'phone']; |
142 | 142 | |
143 | - if(!array_keys_exist($client_data, $required_values)){ |
|
143 | + if (!array_keys_exist($client_data, $required_values)) { |
|
144 | 144 | throw new RequiredValuesMissing("Missing required values :("); |
145 | 145 | } |
146 | 146 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * @param string $client_id |
158 | 158 | * @return object |
159 | 159 | */ |
160 | - public function getClient($client_id = null){ |
|
161 | - if(!$client_id){ |
|
160 | + public function getClient($client_id = null) { |
|
161 | + if (!$client_id) { |
|
162 | 162 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id"); |
163 | 163 | } |
164 | 164 | |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * Required fields - 'first_name', 'last_name', 'email', 'phone' |
179 | 179 | * Optional - 'address', 'company_name', 'type', 'settlement_bank', 'account_number' |
180 | 180 | */ |
181 | - public function editClient( $client_id, array $client_data){ |
|
182 | - if(!$client_id){ |
|
181 | + public function editClient($client_id, array $client_data) { |
|
182 | + if (!$client_id) { |
|
183 | 183 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id"); |
184 | 184 | } |
185 | 185 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // Mandatory fields |
189 | 189 | $required_values = ['first_name', 'last_name', 'email', 'phone']; |
190 | 190 | |
191 | - if(!array_keys_exist($client_data, $required_values)){ |
|
191 | + if (!array_keys_exist($client_data, $required_values)) { |
|
192 | 192 | throw new RequiredValuesMissing("Missing required values :("); |
193 | 193 | } |
194 | 194 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | * [deleteClient] |
204 | 204 | * @param string $client_id [description] |
205 | 205 | */ |
206 | - public function deleteClient($client_id = null){ |
|
207 | - if(!$client_id){ |
|
206 | + public function deleteClient($client_id = null) { |
|
207 | + if (!$client_id) { |
|
208 | 208 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id"); |
209 | 209 | } |
210 | 210 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @param string $fee_bearer [Mandatory] |
228 | 228 | * @param array $items [Mandatory] |
229 | 229 | */ |
230 | - public function addInvoice($client_id, array $client_data, $due_date, $fee_bearer, array $items){ |
|
230 | + public function addInvoice($client_id, array $client_data, $due_date, $fee_bearer, array $items) { |
|
231 | 231 | // Mandatory Client fields |
232 | 232 | $required_client_values = ['first_name', 'last_name', 'email', 'phone']; |
233 | 233 | |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | |
238 | 238 | |
239 | 239 | // Either the client Id is supplied or a new client data is provided |
240 | - if(!$client_id && !array_keys_exist($client_data, $required_client_values)){ |
|
240 | + if (!$client_id && !array_keys_exist($client_data, $required_client_values)) { |
|
241 | 241 | throw new RequiredValuesMissing("Missing required values :( - Provide client_id or client_data"); |
242 | 242 | } |
243 | 243 | |
244 | - if(!$due_date){ |
|
244 | + if (!$due_date) { |
|
245 | 245 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Due Date"); |
246 | 246 | } |
247 | 247 | |
248 | - if(!$fee_bearer){ |
|
248 | + if (!$fee_bearer) { |
|
249 | 249 | throw new IsNull("Error Processing Request - Null Fee Bearer"); |
250 | 250 | }elseif (!in_array($fee_bearer, $valid_fee_bearers)) { |
251 | 251 | throw new InvalidFeeBearer("Invalid Fee Bearer - Use either 'account' or 'client'"); |
252 | 252 | } |
253 | 253 | |
254 | - if(!is_array($items)){ |
|
254 | + if (!is_array($items)) { |
|
255 | 255 | throw new IsInvalid("Error Processing Request - Invalid Items"); |
256 | 256 | } |
257 | 257 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * @param string $reference_code [Mandatory - Invoice Reference Code] |
278 | 278 | * @return object |
279 | 279 | */ |
280 | - public function getInvoice(string $reference_code){ |
|
281 | - if(!$reference_code){ |
|
280 | + public function getInvoice(string $reference_code) { |
|
281 | + if (!$reference_code) { |
|
282 | 282 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
283 | 283 | } |
284 | 284 | |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | * @param string $reference_code [Mandatory - Invoice Reference Code] |
297 | 297 | * @return object |
298 | 298 | */ |
299 | - public function sendInvoice(string $reference_code = null){ |
|
300 | - if(!$reference_code){ |
|
299 | + public function sendInvoice(string $reference_code = null) { |
|
300 | + if (!$reference_code) { |
|
301 | 301 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
302 | 302 | } |
303 | 303 | |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | * @param string $end [Format - DD/MM/YYYY] |
318 | 318 | * @return object |
319 | 319 | */ |
320 | - public function getInvoiceHistory($period, $start = null, $end = null){ |
|
321 | - if(!$period){ |
|
320 | + public function getInvoiceHistory($period, $start = null, $end = null) { |
|
321 | + if (!$period) { |
|
322 | 322 | throw new RequiredValueMissing("Error Processing Request - period Missing"); |
323 | 323 | } |
324 | 324 | |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | * @param string $reference_code [Mandatory - Invoice Reference Code] |
339 | 339 | * @return object |
340 | 340 | */ |
341 | - public function deleteInvoice(string $reference_code){ |
|
342 | - if(!$reference_code){ |
|
341 | + public function deleteInvoice(string $reference_code) { |
|
342 | + if (!$reference_code) { |
|
343 | 343 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
344 | 344 | } |
345 | 345 | |
@@ -360,15 +360,15 @@ discard block |
||
360 | 360 | * @param string $amount [Mandatory] |
361 | 361 | * @return object |
362 | 362 | */ |
363 | - public function addTransfer(array $client_data, string $amount){ |
|
363 | + public function addTransfer(array $client_data, string $amount) { |
|
364 | 364 | // Mandatory Client fields |
365 | 365 | $required_client_values = ['first_name', 'last_name', 'email', 'phone', 'settlement_bank', 'account_number']; |
366 | 366 | |
367 | - if(!array_keys_exist($client_data, $required_client_values)){ |
|
367 | + if (!array_keys_exist($client_data, $required_client_values)) { |
|
368 | 368 | throw new RequiredValuesMissing("Missing required values :( - Provide client_data"); |
369 | 369 | } |
370 | 370 | |
371 | - if(!$amount){ |
|
371 | + if (!$amount) { |
|
372 | 372 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid amount"); |
373 | 373 | } |
374 | 374 | |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | * @param string $reference_code [Mandatory - Transfer Reference Code] |
392 | 392 | * @return object |
393 | 393 | */ |
394 | - public function getTransfer(string $reference_code){ |
|
395 | - if(!$reference_code){ |
|
394 | + public function getTransfer(string $reference_code) { |
|
395 | + if (!$reference_code) { |
|
396 | 396 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
397 | 397 | } |
398 | 398 | |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | * @param string $end [Format - DD/MM/YYYY] |
414 | 414 | * @return object |
415 | 415 | */ |
416 | - public function getTransferHistory($period, $start = null, $end = null){ |
|
417 | - if(!$period){ |
|
416 | + public function getTransferHistory($period, $start = null, $end = null) { |
|
417 | + if (!$period) { |
|
418 | 418 | throw new RequiredValueMissing("Error Processing Request - period Missing"); |
419 | 419 | } |
420 | 420 | |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | * @param string $reference_code [Mandatory - Invoice Reference Code] |
436 | 436 | * @return object |
437 | 437 | */ |
438 | - public function deleteTransfer(string $reference_code){ |
|
439 | - if(!$reference_code){ |
|
438 | + public function deleteTransfer(string $reference_code) { |
|
439 | + if (!$reference_code) { |
|
440 | 440 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
441 | 441 | } |
442 | 442 | |
@@ -458,22 +458,22 @@ discard block |
||
458 | 458 | * @param string $channel [Mandatory - valid ["Cash", "BankTransfer", "POS", "Cheque"]] |
459 | 459 | * @return object |
460 | 460 | */ |
461 | - public function addPayment(string $reference_code, string $due_date, string $amount, string $channel){ |
|
462 | - if(!$reference_code){ |
|
461 | + public function addPayment(string $reference_code, string $due_date, string $amount, string $channel) { |
|
462 | + if (!$reference_code) { |
|
463 | 463 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
464 | 464 | } |
465 | 465 | |
466 | - if(!$due_date){ |
|
466 | + if (!$due_date) { |
|
467 | 467 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid date"); |
468 | 468 | } |
469 | 469 | |
470 | - if(!$amount){ |
|
470 | + if (!$amount) { |
|
471 | 471 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid amount"); |
472 | 472 | } |
473 | 473 | |
474 | 474 | $valid_channels = ["Cash", "BankTransfer", "POS", "Cheque"]; |
475 | 475 | |
476 | - if(!$channel){ |
|
476 | + if (!$channel) { |
|
477 | 477 | throw new IsNull("Error Processing Request - Null/Invalid amount"); |
478 | 478 | }elseif (!in_array(ucfirst($channel), $valid_channels)) { |
479 | 479 | throw new IsInvalid("Invalid Channel - Cash, BankTransfer, POS or Cheque"); |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | * @param string $reference_code [Mandatory - Invoice Reference Code] |
501 | 501 | * @return object |
502 | 502 | */ |
503 | - public function getPayment(string $reference_code){ |
|
504 | - if(!$reference_code){ |
|
503 | + public function getPayment(string $reference_code) { |
|
504 | + if (!$reference_code) { |
|
505 | 505 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
506 | 506 | } |
507 | 507 | |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | * @param string $end [Format - DD/MM/YYYY || Optional if $period !== 'custom'] |
522 | 522 | * @return object |
523 | 523 | */ |
524 | - public function getPaymentHistory(string $period, string $start, string $end){ |
|
525 | - if(!$period){ |
|
524 | + public function getPaymentHistory(string $period, string $start, string $end) { |
|
525 | + if (!$period) { |
|
526 | 526 | throw new RequiredValueMissing("Error Processing Request - period Missing"); |
527 | 527 | } |
528 | 528 | |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | * @param string $passcode [Mandatory - Wallet's passcode] |
545 | 545 | * @return object |
546 | 546 | */ |
547 | - public function addWallet(string $name, string $passcode){ |
|
548 | - if(!$name){ |
|
547 | + public function addWallet(string $name, string $passcode) { |
|
548 | + if (!$name) { |
|
549 | 549 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid name"); |
550 | 550 | } |
551 | 551 | |
552 | - if(!$passcode || strlen($passcode) < 6){ |
|
552 | + if (!$passcode || strlen($passcode) < 6) { |
|
553 | 553 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid passcode/ length"); |
554 | 554 | } |
555 | 555 | |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | * @param string $reference_code [Mandatory - Wallet's Reference Code] |
573 | 573 | * @return object |
574 | 574 | */ |
575 | - public function getWallet(string $reference_code){ |
|
576 | - if(!$reference_code){ |
|
575 | + public function getWallet(string $reference_code) { |
|
576 | + if (!$reference_code) { |
|
577 | 577 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
578 | 578 | } |
579 | 579 | |
@@ -593,16 +593,16 @@ discard block |
||
593 | 593 | * @param string $passcode [Mandatory - Wallet's Passcode] |
594 | 594 | * @return object |
595 | 595 | */ |
596 | - public function changeWalletPasscode(string $reference_code, string $old_passcode, string $passcode){ |
|
597 | - if(!$reference_code){ |
|
596 | + public function changeWalletPasscode(string $reference_code, string $old_passcode, string $passcode) { |
|
597 | + if (!$reference_code) { |
|
598 | 598 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
599 | 599 | } |
600 | 600 | |
601 | - if(!$old_passcode){ |
|
601 | + if (!$old_passcode) { |
|
602 | 602 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid old_passcode"); |
603 | 603 | } |
604 | 604 | |
605 | - if(!$passcode || strlen($passcode) < 6){ |
|
605 | + if (!$passcode || strlen($passcode) < 6) { |
|
606 | 606 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid passcode"); |
607 | 607 | } |
608 | 608 | |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * [getWallets] |
625 | 625 | * @return object |
626 | 626 | */ |
627 | - public function getWallets(){ |
|
627 | + public function getWallets() { |
|
628 | 628 | |
629 | 629 | $url = "/wallets"; |
630 | 630 | |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | * @param string $reference_code [Mandatory - Wallet's Reference Code] |
641 | 641 | * @return object |
642 | 642 | */ |
643 | - public function setWalletStatus(string $reference_code){ |
|
644 | - if(!$reference_code){ |
|
643 | + public function setWalletStatus(string $reference_code) { |
|
644 | + if (!$reference_code) { |
|
645 | 645 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
646 | 646 | } |
647 | 647 | |
@@ -663,23 +663,23 @@ discard block |
||
663 | 663 | * @param string $passcode [Mandatory - Wallet's Passcode] |
664 | 664 | * @return object |
665 | 665 | */ |
666 | - public function withdrawFromWallet(string $reference_code, array $client_data, string $amount, string $passcode){ |
|
667 | - if(!$reference_code){ |
|
666 | + public function withdrawFromWallet(string $reference_code, array $client_data, string $amount, string $passcode) { |
|
667 | + if (!$reference_code) { |
|
668 | 668 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
669 | 669 | } |
670 | 670 | |
671 | 671 | // Mandatory fields |
672 | 672 | $required_values = ['settlement_bank', 'account_number']; |
673 | 673 | |
674 | - if(!array_keys_exist($client_data, $required_values)){ |
|
674 | + if (!array_keys_exist($client_data, $required_values)) { |
|
675 | 675 | throw new RequiredValuesMissing("Missing required values :("); |
676 | 676 | } |
677 | 677 | |
678 | - if(!$amount){ |
|
678 | + if (!$amount) { |
|
679 | 679 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid amount"); |
680 | 680 | } |
681 | 681 | |
682 | - if(!$passcode){ |
|
682 | + if (!$passcode) { |
|
683 | 683 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid passcode"); |
684 | 684 | } |
685 | 685 | |
@@ -707,12 +707,12 @@ discard block |
||
707 | 707 | * @param string $end [Format - DD/MM/YYYY] |
708 | 708 | * @return object |
709 | 709 | */ |
710 | - public function getWalletTransactions(string $reference_code, $period, $start = null, $end = null){ |
|
711 | - if(!$reference_code){ |
|
710 | + public function getWalletTransactions(string $reference_code, $period, $start = null, $end = null) { |
|
711 | + if (!$reference_code) { |
|
712 | 712 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid reference_code"); |
713 | 713 | } |
714 | 714 | |
715 | - if(!$period){ |
|
715 | + if (!$period) { |
|
716 | 716 | throw new RequiredValueMissing("Error Processing Request - period Missing"); |
717 | 717 | } |
718 | 718 | |
@@ -735,23 +735,23 @@ discard block |
||
735 | 735 | * @param string $type [Mandatory - Product type 'product' or 'service'] |
736 | 736 | * @return object |
737 | 737 | */ |
738 | - public function addProduct(string $name, string $description, string $unit_cost, string $type){ |
|
739 | - if(!$name){ |
|
738 | + public function addProduct(string $name, string $description, string $unit_cost, string $type) { |
|
739 | + if (!$name) { |
|
740 | 740 | throw new IsNull("Error Processing Request - Null/Invalid name"); |
741 | 741 | } |
742 | 742 | |
743 | - if(!$description){ |
|
743 | + if (!$description) { |
|
744 | 744 | throw new IsNull("Error Processing Request - Null/Invalid description"); |
745 | 745 | } |
746 | 746 | |
747 | - if(!$unit_cost){ |
|
747 | + if (!$unit_cost) { |
|
748 | 748 | throw new IsNull("Error Processing Request - Null/Invalid unit_cost"); |
749 | 749 | } |
750 | 750 | |
751 | 751 | //Validate Product Type |
752 | 752 | $valid_product_type = ["product", "service"]; |
753 | 753 | |
754 | - if(!$type){ |
|
754 | + if (!$type) { |
|
755 | 755 | throw new IsNull("Error Processing Request - Null/Invalid type"); |
756 | 756 | }elseif (!in_array(strtolower($type), $valid_product_type)) { |
757 | 757 | throw new IsInvalid("Invalid Type - Available options: 'product' or 'service'"); |
@@ -778,8 +778,8 @@ discard block |
||
778 | 778 | * @param int $product_id [Mandatory - Product ID] |
779 | 779 | * @return object |
780 | 780 | */ |
781 | - public function getProduct($product_id){ |
|
782 | - if(!$product_id){ |
|
781 | + public function getProduct($product_id) { |
|
782 | + if (!$product_id) { |
|
783 | 783 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid product_id"); |
784 | 784 | } |
785 | 785 | |
@@ -798,8 +798,8 @@ discard block |
||
798 | 798 | * @param array $product_data [description] |
799 | 799 | * @return object |
800 | 800 | */ |
801 | - public function editProduct($product_id, array $product_data){ |
|
802 | - if(!$product_id){ |
|
801 | + public function editProduct($product_id, array $product_data) { |
|
802 | + if (!$product_id) { |
|
803 | 803 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Product Id"); |
804 | 804 | } |
805 | 805 | |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | |
809 | 809 | $valid_product_type = ["product", "service"]; |
810 | 810 | |
811 | - if(!$product_type){ |
|
811 | + if (!$product_type) { |
|
812 | 812 | throw new IsNull("Error Processing Request - Null/Invalid type"); |
813 | 813 | }elseif (!in_array($product_type, $valid_product_type)) { |
814 | 814 | throw new IsInvalid("Invalid Type - Available options: 'product' or 'service'"); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | // Mandatory fields |
820 | 820 | $required_values = ['name', 'description', 'unit_cost', 'type']; |
821 | 821 | |
822 | - if(!array_keys_exist($product_data, $required_values)){ |
|
822 | + if (!array_keys_exist($product_data, $required_values)) { |
|
823 | 823 | throw new RequiredValuesMissing("Missing required values :("); |
824 | 824 | } |
825 | 825 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | * [getProducts] |
834 | 834 | * @return object |
835 | 835 | */ |
836 | - public function getProducts(){ |
|
836 | + public function getProducts() { |
|
837 | 837 | $url = "/products"; |
838 | 838 | |
839 | 839 | return $this->sendRequest('get', $url); |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | * @param $product_id [Mandatory - Product ID] |
848 | 848 | * @return object |
849 | 849 | */ |
850 | - public function deleteProduct($product_id){ |
|
851 | - if(!$product_id){ |
|
850 | + public function deleteProduct($product_id) { |
|
851 | + if (!$product_id) { |
|
852 | 852 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Product Id"); |
853 | 853 | } |
854 | 854 | |
@@ -866,22 +866,22 @@ discard block |
||
866 | 866 | * @param array $params [data to post to request url] |
867 | 867 | * @return object |
868 | 868 | */ |
869 | - public function sendRequest($method, $url, $params=[]) |
|
869 | + public function sendRequest($method, $url, $params = []) |
|
870 | 870 | { |
871 | - try{ |
|
872 | - if (strtolower($method) == 'get'){ |
|
871 | + try { |
|
872 | + if (strtolower($method) == 'get') { |
|
873 | 873 | $result = $this->client->request('GET', $url); |
874 | - }elseif (strtolower($method) == 'post'){ |
|
874 | + }elseif (strtolower($method) == 'post') { |
|
875 | 875 | $result = $this->client->request('POST', $url, $params); |
876 | - }elseif (strtolower($method) == 'put'){ |
|
876 | + }elseif (strtolower($method) == 'put') { |
|
877 | 877 | $result = $this->client->request('PUT', $url, $params); |
878 | - }elseif (strtolower($method) == 'delete'){ |
|
878 | + }elseif (strtolower($method) == 'delete') { |
|
879 | 879 | $result = $this->client->request('DELETE', $url); |
880 | 880 | } |
881 | 881 | |
882 | 882 | return cleanResponse($result); |
883 | 883 | } |
884 | - catch( Exception $e){ |
|
884 | + catch (Exception $e) { |
|
885 | 885 | throw $e; |
886 | 886 | } |
887 | 887 | } |