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.

Ecommerce   A
last analyzed

Complexity

Total Complexity 27

Size/Duplication

Total Lines 324
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 82
c 1
b 0
f 1
dl 0
loc 324
rs 10
wmc 27

27 Methods

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