@@ -164,7 +164,7 @@ |
||
| 164 | 164 | */ |
| 165 | 165 | public function setDeliveryMethod(string $delivery_method): void |
| 166 | 166 | { |
| 167 | - if (!in_array($delivery_method, ['direct', 'instant'])) { |
|
| 167 | + if (!in_array($delivery_method, [ 'direct', 'instant' ])) { |
|
| 168 | 168 | throw new Exception('Invalid delivery method: ' . $delivery_method); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | continue; |
| 24 | 24 | } |
| 25 | 25 | if ($value instanceof DateTime) { |
| 26 | - $data[$key] = $value->format('Y-m-d H:i:s'); |
|
| 26 | + $data[ $key ] = $value->format('Y-m-d H:i:s'); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** @var Client $client */ |
| 13 | 13 | |
| 14 | 14 | |
| 15 | -$orderRequest = new OrderRequest('ZAPPO-US',10,'USD'); |
|
| 15 | +$orderRequest = new OrderRequest('ZAPPO-US', 10, 'USD'); |
|
| 16 | 16 | $orderRequest->setIdempotencyKey(uniqid()); |
| 17 | 17 | |
| 18 | 18 | $orderResponse = $client->createAnOrder($orderRequest); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @var Ecode[] |
| 15 | 15 | */ |
| 16 | - protected array $e_codes = []; |
|
| 16 | + protected array $e_codes = [ ]; |
|
| 17 | 17 | protected string $error_code; |
| 18 | 18 | protected string $error_details; |
| 19 | 19 | protected string $error_string; |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function setECodes(array $e_codes): void |
| 51 | 51 | { |
| 52 | - $this->e_codes = []; |
|
| 52 | + $this->e_codes = [ ]; |
|
| 53 | 53 | |
| 54 | 54 | foreach ($e_codes as $e_code) { |
| 55 | - $this->e_codes[] = new Ecode($e_code); |
|
| 55 | + $this->e_codes[ ] = new Ecode($e_code); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function authentication(): AuthResponse |
| 65 | 65 | { |
| 66 | 66 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/auth', [ |
| 67 | - 'auth' => [$this->user_id, $this->api_key] |
|
| 67 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
| 68 | 68 | ]); |
| 69 | 69 | |
| 70 | 70 | return new AuthResponse(json_decode($response->getBody(), true)); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if ( |
| 76 | 76 | !in_array( |
| 77 | 77 | $currency_code, |
| 78 | - ['AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'USD'] |
|
| 78 | + [ 'AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'USD' ] |
|
| 79 | 79 | ) |
| 80 | 80 | ) { |
| 81 | 81 | // Murder a kitten... |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/balance/' . $currency_code, [ |
| 86 | - 'auth' => [$this->user_id, $this->api_key] |
|
| 86 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
| 87 | 87 | ]); |
| 88 | 88 | |
| 89 | 89 | return new Balance(json_decode($response->getBody(), true)); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | public function listAllProducts(): Generator |
| 101 | 101 | { |
| 102 | 102 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/products', [ |
| 103 | - 'auth' => [$this->user_id, $this->api_key] |
|
| 103 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
| 104 | 104 | ]); |
| 105 | 105 | |
| 106 | 106 | $json = json_decode($response->getBody(), true); |
| 107 | - foreach ($json['products'] as $product) { |
|
| 107 | + foreach ($json[ 'products' ] as $product) { |
|
| 108 | 108 | yield new Product($product); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function findAProduct($product_code): Product |
| 113 | 113 | { |
| 114 | 114 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/products/' . $product_code, [ |
| 115 | - 'auth' => [$this->user_id, $this->api_key] |
|
| 115 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
| 116 | 116 | ]); |
| 117 | 117 | |
| 118 | 118 | return new Product(json_decode($response->getBody(), true)); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | 'headers' => [ |
| 125 | 125 | 'content-type' => 'application/json', |
| 126 | 126 | ], |
| 127 | - 'auth' => [$this->user_id, $this->api_key], |
|
| 127 | + 'auth' => [ $this->user_id, $this->api_key ], |
|
| 128 | 128 | 'body' => json_encode($order_request) |
| 129 | 129 | ]); |
| 130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function findOrderDetails($order_id) |
| 135 | 135 | { |
| 136 | 136 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/order-details/' . $order_id, [ |
| 137 | - 'auth' => [$this->user_id, $this->api_key] |
|
| 137 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
| 138 | 138 | ]); |
| 139 | 139 | |
| 140 | 140 | return new OrderDetails(json_decode($response->getBody(), true)); |