@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if (null === self::$isMbstringAvailable) { |
| 23 | 23 | self::$isMbstringAvailable = function_exists('mb_detect_encoding'); |
| 24 | 24 | |
| 25 | - if (! self::$isMbstringAvailable) { |
|
| 25 | + if (!self::$isMbstringAvailable) { |
|
| 26 | 26 | trigger_error('It looks like the mbstring extension is not enabled. ' . |
| 27 | 27 | 'UTF-8 strings will not properly be encoded. Ask your system ' . |
| 28 | 28 | 'administrator to enable the mbstring extension.', E_USER_WARNING); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function convertArrayToObject($resp) |
| 47 | 47 | { |
| 48 | - if (! is_array($resp)) { |
|
| 48 | + if (!is_array($resp)) { |
|
| 49 | 49 | $message = 'The response passed must be an array'; |
| 50 | 50 | |
| 51 | 51 | throw new InvalidArgumentException($message); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | private static function validateApiKey($apiKey) : bool |
| 38 | 38 | { |
| 39 | - if ($apiKey == '' || ! is_string($apiKey)) { |
|
| 39 | + if ($apiKey == '' || !is_string($apiKey)) { |
|
| 40 | 40 | throw new InvalidArgumentException('Api key must be a string and cannot be empty'); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | public static function validateParams($params = null, $required = false) : void |
| 36 | 36 | { |
| 37 | 37 | if ($required) { |
| 38 | - if (empty($params) || ! is_array($params)) { |
|
| 38 | + if (empty($params) || !is_array($params)) { |
|
| 39 | 39 | $message = 'The parameter passed must be an array and must not be empty'; |
| 40 | 40 | |
| 41 | 41 | throw new InvalidArgumentException($message); |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | - if ($params && ! is_array($params)) { |
|
| 44 | + if ($params && !is_array($params)) { |
|
| 45 | 45 | $message = 'The parameter passed must be an array'; |
| 46 | 46 | |
| 47 | 47 | throw new InvalidArgumentException($message); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @throws InvalidArgumentException |
| 58 | 58 | * @throws IsNullException |
| 59 | 59 | */ |
| 60 | - public static function staticRequest($method, $url, $params = [], $return_type = 'obj') |
|
| 60 | + public static function staticRequest($method, $url, $params = [ ], $return_type = 'obj') |
|
| 61 | 61 | { |
| 62 | 62 | if ($return_type != 'arr' && $return_type != 'obj') { |
| 63 | 63 | throw new InvalidArgumentException("Return type can only be obj or arr"); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | protected static function setRequestOptions() : void |
| 78 | 78 | { |
| 79 | - $authBearer = 'Bearer '. Paystack::$apiKey; |
|
| 79 | + $authBearer = 'Bearer ' . Paystack::$apiKey; |
|
| 80 | 80 | |
| 81 | 81 | static::$client = new Client( |
| 82 | 82 | [ |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @throws IsNullException |
| 99 | 99 | */ |
| 100 | - private static function setHttpResponse($method, $url, $body = []) : \GuzzleHttp\Psr7\Response |
|
| 100 | + private static function setHttpResponse($method, $url, $body = [ ]) : \GuzzleHttp\Psr7\Response |
|
| 101 | 101 | { |
| 102 | 102 | if (is_null($method)) { |
| 103 | 103 | throw new IsNullException("Empty method not allowed"); |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | static::setRequestOptions(); |
| 107 | 107 | |
| 108 | 108 | static::$response = static::$client->{strtolower($method)}( |
| 109 | - Paystack::$apiBase . '/'. $url, |
|
| 110 | - ["body" => json_encode($body)] |
|
| 109 | + Paystack::$apiBase . '/' . $url, |
|
| 110 | + [ "body" => json_encode($body) ] |
|
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | return static::$response; |
@@ -128,6 +128,6 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private static function getResponseData() : array |
| 130 | 130 | { |
| 131 | - return json_decode(static::$response->getBody(), true)['data']; |
|
| 131 | + return json_decode(static::$response->getBody(), true)[ 'data' ]; |
|
| 132 | 132 | } |
| 133 | 133 | } |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | { |
| 15 | 15 | self::validateParams($params); |
| 16 | 16 | $url = static::classUrl(); |
| 17 | - if (! empty($params)) { |
|
| 18 | - $url .= '?'. http_build_query($params); |
|
| 17 | + if (!empty($params)) { |
|
| 18 | + $url .= '?' . http_build_query($params); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | return static::staticRequest('GET', $url); |
@@ -73,8 +73,8 @@ |
||
| 73 | 73 | public static function buildQueryString($slug, $params = null) |
| 74 | 74 | { |
| 75 | 75 | $url = self::endPointUrl($slug); |
| 76 | - if (! empty($params)) { |
|
| 77 | - $url .= '?'. http_build_query($params); |
|
| 76 | + if (!empty($params)) { |
|
| 77 | + $url .= '?' . http_build_query($params); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $url; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public static function checkSlugAvailability($slug) |
| 21 | 21 | { |
| 22 | - $slug = 'check_slug_availability/'.$slug; |
|
| 22 | + $slug = 'check_slug_availability/' . $slug; |
|
| 23 | 23 | $url = static::endPointUrl($slug); |
| 24 | 24 | |
| 25 | 25 | return static::staticRequest('GET', $url); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public static function addProducts($page_id, $params) |
| 35 | 35 | { |
| 36 | 36 | self::validateParams($params, true); |
| 37 | - $url = static::resourceUrl($page_id).'/product'; |
|
| 37 | + $url = static::resourceUrl($page_id) . '/product'; |
|
| 38 | 38 | |
| 39 | 39 | return static::staticRequest('POST', $url); |
| 40 | 40 | } |