GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 055802...1917ae )
by
unknown
04:27
created

Ecommerce::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusMailchimpPlugin\Api;
6
7
use DrewM\MailChimp\MailChimp;
8
use Psr\Log\LoggerInterface;
9
10
class Ecommerce extends MailChimp implements EcommerceInterface
11
{
12
    /**
13
     * @var LoggerInterface
14
     */
15
    private $logger;
16
17
    /**
18
     * @param $api_key
19
     * @param LoggerInterface $logger
20
     *
21
     * @throws \Exception
22
     */
23
    public function __construct(
24
        $api_key,
25
        LoggerInterface $logger
26
    ) {
27
        parent::__construct($api_key);
28
29
        $this->logger = $logger;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function addStore(array $data)
36
    {
37
        $response = $this->post('ecommerce/stores', $data);
38
39
        $this->logger->info('add_store: '.json_encode($response));
40
41
        return $response;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getStores()
48
    {
49
        $response = $this->get('ecommerce/stores');
50
51
        $this->logger->info('get_stores: '.json_encode($response));
52
53
        return $response;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getStore(string $storeId)
60
    {
61
        $response = $this->get('ecommerce/stores/' . $storeId);
62
63
        $this->logger->info('get_store: '.json_encode($response));
64
65
        return $response;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function updateStore(string $storeId, array $data)
72
    {
73
        $response = $this->patch('ecommerce/stores/' . $storeId, $data);
74
75
        $this->logger->info('update_store: '.json_encode($response));
76
77
        return $response;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83
    public function removeStore(string $storeId)
84
    {
85
        $response = $this->delete('ecommerce/stores/' . $storeId);
86
87
        $this->logger->info('remove_store: '.json_encode($response));
88
89
        return $response;
90
    }
91
92
    /**
93
     * {@inheritdoc}
94
     */
95
    public function addCustomer(string $storeId, array $data)
96
    {
97
        $response = $this->post('ecommerce/stores/' . $storeId . '/customers', $data);
98
99
        $this->logger->info('add_customer: '.json_encode($response));
100
101
        return $response;
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function getCustomers(string $storeId)
108
    {
109
        $response = $this->get('ecommerce/stores/' . $storeId . '/customers');
110
111
        $this->logger->info('get_customers: '.json_encode($response));
112
113
        return $response;
114
    }
115
116
    /**
117
     * {@inheritdoc}
118
     */
119
    public function getCustomer(string $storeId, string $customerId)
120
    {
121
        $response = $this->get('ecommerce/stores/' . $storeId . '/customers/' . $customerId);
122
123
        $this->logger->info('get_customer: '.json_encode($response));
124
125
        return $response;
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function updateCustomer(string $storeId, string $customerId, array $data)
132
    {
133
        $response = $this->patch('ecommerce/stores/' . $storeId . '/customers/' . $customerId, $data);
134
135
        $this->logger->info('update_customer: '.json_encode($response));
136
137
        return $response;
138
    }
139
140
    /**
141
     * {@inheritdoc}
142
     */
143
    public function removeCustomer(string $storeId, string $customerId)
144
    {
145
        $response = $this->delete('ecommerce/stores/' . $storeId . '/customers/' . $customerId);
146
147
        $this->logger->info('remove_customer: '.json_encode($response));
148
149
        return $response;
150
    }
151
152
    /**
153
     * {@inheritdoc}
154
     */
155
    public function addProduct(string $storeId, array $data)
156
    {
157
        $response = $this->post('ecommerce/stores/' . $storeId . '/products', $data);
158
159
        $this->logger->info('add_product: '.json_encode($response));
160
161
        return $response;
162
    }
163
164
    /**
165
     * {@inheritdoc}
166
     */
167
    public function getProducts(string $storeId)
168
    {
169
        $response = $this->get('ecommerce/stores/' . $storeId . '/products');
170
171
        $this->logger->info('get_products: '.json_encode($response));
172
173
        return $response;
174
    }
175
176
    /**
177
     * {@inheritdoc}
178
     */
179
    public function getProduct(string $storeId, string $productId)
180
    {
181
        $response = $this->get('ecommerce/stores/' . $storeId . '/products/' . $productId);
182
183
        $this->logger->info('get_product: '.json_encode($response));
184
185
        return $response;
186
    }
187
188
    /**
189
     * {@inheritdoc}
190
     */
191
    public function updateProduct(string $storeId, string $productId, array $data)
192
    {
193
        $response = $this->patch('ecommerce/stores/' . $storeId . '/products/' . $productId, $data);
194
195
        $this->logger->info('update_product: '.json_encode($response));
196
197
        return $response;
198
    }
199
200
    /**
201
     * {@inheritdoc}
202
     */
203
    public function removeProduct(string $storeId, string $productId)
204
    {
205
        $response = $this->delete('ecommerce/stores/' . $storeId . '/products/' . $productId);
206
207
        $this->logger->info('remove_product: '.json_encode($response));
208
209
        return $response;
210
    }
211
212
    /**
213
     * {@inheritdoc}
214
     */
215
    public function addOrder(string $storeId, array $data)
216
    {
217
        $response = $this->post('ecommerce/stores/' . $storeId . '/orders', $data);
218
219
        $this->logger->info('add_order: '.json_encode($response));
220
221
        return $response;
222
    }
223
224
    /**
225
     * {@inheritdoc}
226
     */
227
    public function getOrders()
228
    {
229
        $response = $this->get('ecommerce/orders');
230
231
        $this->logger->info('get_orders: '.json_encode($response));
232
233
        return $response;
234
    }
235
236
    /**
237
     * {@inheritdoc}
238
     */
239
    public function getOrdersByStore(string $storeId)
240
    {
241
        $response = $this->get('ecommerce/stores/' . $storeId . '/orders');
242
243
        $this->logger->info('get_order_by_store: '.json_encode($response));
244
245
        return $response;
246
    }
247
248
    /**
249
     * {@inheritdoc}
250
     */
251
    public function getOrder(string $storeId, string $orderId)
252
    {
253
        $response = $this->get('ecommerce/stores/' . $storeId . '/orders/' . $orderId);
254
255
        $this->logger->info('get_order: '.json_encode($response));
256
257
        return $response;
258
    }
259
260
    /**
261
     * {@inheritdoc}
262
     */
263
    public function updateOrder(string $storeId, string $orderId, array $data)
264
    {
265
        $response = $this->patch('ecommerce/stores/' . $storeId . '/orders/' . $orderId, $data);
266
267
        $this->logger->info('update_order: '.json_encode($response));
268
269
        return $response;
270
    }
271
272
    /**
273
     * {@inheritdoc}
274
     */
275
    public function removeOrder(string $storeId, string $orderId)
276
    {
277
        $response = $this->delete('ecommerce/stores/' . $storeId . '/orders/' . $orderId);
278
279
        $this->logger->info('remove_order: '.json_encode($response));
280
281
        return $response;
282
    }
283
284
    /**
285
     * {@inheritdoc}
286
     */
287
    public function addCart(string $storeId, array $data)
288
    {
289
        $response = $this->post('ecommerce/stores/' . $storeId . '/carts', $data);
290
291
        $this->logger->info('add_cart: '.json_encode($response));
292
293
        return $response;
294
    }
295
296
    /**
297
     * {@inheritdoc}
298
     */
299
    public function getCarts(string $storeId)
300
    {
301
        $response = $this->get('ecommerce/stores/' . $storeId . '/carts');
302
303
        $this->logger->info('get_carts: '.json_encode($response));
304
305
        return $response;
306
    }
307
308
    /**
309
     * {@inheritdoc}
310
     */
311
    public function getCart(string $storeId, string $cartId)
312
    {
313
        $response = $this->get('ecommerce/stores/' . $storeId . '/carts/' . $cartId);
314
315
        $this->logger->info('get_cart: '.json_encode($response));
316
317
        return $response;
318
    }
319
320
    /**
321
     * {@inheritdoc}
322
     */
323
    public function updateCart(string $storeId, string $cartId, array $data)
324
    {
325
        $response = $this->patch('ecommerce/stores/' . $storeId . '/carts/' . $cartId, $data);
326
327
        $this->logger->info('update_cart: '.json_encode($response));
328
329
        return $response;
330
    }
331
332
    /**
333
     * {@inheritdoc}
334
     */
335
    public function removeCart(string $storeId, string $cartId)
336
    {
337
        $response = $this->delete('ecommerce/stores/' . $storeId . '/carts/' . $cartId);
338
339
        $this->logger->info('remove_cart: '.json_encode($response));
340
341
        return $response;
342
    }
343
}
344