@@ -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 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function authentication(): AuthResponse |
64 | 64 | { |
65 | 65 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/auth', [ |
66 | - 'auth' => [$this->user_id, $this->api_key] |
|
66 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
67 | 67 | ]); |
68 | 68 | |
69 | 69 | return new AuthResponse(json_decode($response->getBody(), true)); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if ( |
75 | 75 | !in_array( |
76 | 76 | $currency_code, |
77 | - ['AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'USD'] |
|
77 | + [ 'AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'USD' ] |
|
78 | 78 | ) |
79 | 79 | ) { |
80 | 80 | // Murder a kitten... |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/balance/' . $currency_code, [ |
85 | - 'auth' => [$this->user_id, $this->api_key] |
|
85 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
86 | 86 | ]); |
87 | 87 | |
88 | 88 | return new Balance(json_decode($response->getBody(), true)); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | public function listAllProducts(): Generator |
100 | 100 | { |
101 | 101 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/products', [ |
102 | - 'auth' => [$this->user_id, $this->api_key] |
|
102 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
103 | 103 | ]); |
104 | 104 | |
105 | 105 | $json = json_decode($response->getBody(), true); |
106 | - foreach ($json['products'] as $product) { |
|
106 | + foreach ($json[ 'products' ] as $product) { |
|
107 | 107 | yield new Product($product); |
108 | 108 | } |
109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | public function findAProduct($productCode): Product |
112 | 112 | { |
113 | 113 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/products/' . $productCode, [ |
114 | - 'auth' => [$this->user_id, $this->api_key] |
|
114 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
115 | 115 | ]); |
116 | 116 | |
117 | 117 | return new Product(json_decode($response->getBody(), true)); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'headers' => [ |
124 | 124 | 'content-type' => 'application/json', |
125 | 125 | ], |
126 | - 'auth' => [$this->user_id, $this->api_key], |
|
126 | + 'auth' => [ $this->user_id, $this->api_key ], |
|
127 | 127 | 'body' => json_encode($orderRequest) |
128 | 128 | ]); |
129 | 129 |