Total Complexity | 7 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class ListOrdersMethod extends AbstractMethod |
||
16 | { |
||
17 | /** |
||
18 | * Get Order Endpoint |
||
19 | */ |
||
20 | const ENDPOINT = '/orders'; |
||
21 | |||
22 | /** |
||
23 | * @var array $queryParameters |
||
24 | */ |
||
25 | protected $queryParameters; |
||
26 | |||
27 | /** |
||
28 | * @param array $queryParameters |
||
29 | * |
||
30 | * @return $this |
||
31 | */ |
||
32 | public function setQueryParameters(array $queryParameters) |
||
33 | { |
||
34 | $this->queryParameters = $queryParameters; |
||
35 | |||
36 | return $this; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return array|bool |
||
41 | */ |
||
42 | public function getOrders() |
||
43 | { |
||
44 | $response = $this->getResponse(); |
||
45 | if ($response instanceof Response) { |
||
|
|||
46 | $responseBody = $response->body; |
||
47 | $orders = array(); |
||
48 | foreach ($responseBody as $responseOrder) { |
||
49 | $order = new Order(); |
||
50 | $order->import($responseOrder); |
||
51 | $orders[] = $order; |
||
52 | } |
||
53 | |||
54 | return $orders; |
||
55 | } |
||
56 | |||
57 | return false; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return $this|AbstractMethod |
||
62 | * @throws \Httpful\Exception\ConnectionErrorException |
||
63 | * @throws \Pagantis\OrdersApiClient\Exception\HttpException |
||
64 | */ |
||
65 | public function call() |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * prepareRequest |
||
73 | */ |
||
74 | public function prepareRequest() |
||
88 |