@@ -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 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @var Ecode[] |
13 | 13 | */ |
14 | - protected array $e_codes = []; |
|
14 | + protected array $e_codes = [ ]; |
|
15 | 15 | protected string $error_code; |
16 | 16 | protected string $error_details; |
17 | 17 | protected string $error_string; |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function setECodes(array $e_codes): void |
49 | 49 | { |
50 | - $this->e_codes = []; |
|
50 | + $this->e_codes = [ ]; |
|
51 | 51 | |
52 | - foreach($e_codes as $e_code) { |
|
53 | - $this->e_codes[] = new Ecode($e_code); |
|
52 | + foreach ($e_codes as $e_code) { |
|
53 | + $this->e_codes[ ] = new Ecode($e_code); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 |
@@ -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 |
@@ -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)); |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | { |
74 | 74 | if (!in_array( |
75 | 75 | $currency_code, |
76 | - ['AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'USD'] |
|
76 | + [ 'AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HUF', 'NOK', 'NZD', 'PLN', 'SEK', 'USD' ] |
|
77 | 77 | )) { |
78 | 78 | // Murder a kitten... |
79 | 79 | throw new Exception('Unsupported currency code: ' . $currency_code); |
80 | 80 | } |
81 | 81 | |
82 | 82 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/balance/' . $currency_code, [ |
83 | - 'auth' => [$this->user_id, $this->api_key] |
|
83 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
84 | 84 | ]); |
85 | 85 | |
86 | 86 | return new Balance(json_decode($response->getBody(), true)); |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function listAllProducts(): Generator |
98 | 98 | { |
99 | 99 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/products', [ |
100 | - 'auth' => [$this->user_id, $this->api_key] |
|
100 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
101 | 101 | ]); |
102 | 102 | |
103 | 103 | $json = json_decode($response->getBody(), true); |
104 | - foreach ($json['products'] as $product) { |
|
104 | + foreach ($json[ 'products' ] as $product) { |
|
105 | 105 | yield new Product($product); |
106 | 106 | } |
107 | 107 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | public function findAProduct($productCode): Product |
110 | 110 | { |
111 | 111 | $response = $this->getHttpClient()->get($this->getEndpoint() . '/products/' . $productCode, [ |
112 | - 'auth' => [$this->user_id, $this->api_key] |
|
112 | + 'auth' => [ $this->user_id, $this->api_key ] |
|
113 | 113 | ]); |
114 | 114 | |
115 | 115 | return new Product(json_decode($response->getBody(), true)); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'headers' => [ |
122 | 122 | 'content-type' => 'application/json', |
123 | 123 | ], |
124 | - 'auth' => [$this->user_id, $this->api_key], |
|
124 | + 'auth' => [ $this->user_id, $this->api_key ], |
|
125 | 125 | 'body' => json_encode($orderRequest) |
126 | 126 | ]); |
127 | 127 |
@@ -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); |