| Total Complexity | 7 |
| Total Lines | 70 |
| 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) |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return array|bool |
||
| 41 | * |
||
| 42 | * @throws \Exception |
||
| 43 | */ |
||
| 44 | public function getOrders() |
||
| 45 | { |
||
| 46 | $response = $this->getResponse(); |
||
| 47 | if ($response instanceof Response) { |
||
|
|
|||
| 48 | $responseBody = $response->body; |
||
| 49 | $orders = array(); |
||
| 50 | foreach ($responseBody as $responseOrder) { |
||
| 51 | $order = new Order(); |
||
| 52 | $order->import($responseOrder); |
||
| 53 | $orders[] = $order; |
||
| 54 | } |
||
| 55 | |||
| 56 | return $orders; |
||
| 57 | } |
||
| 58 | |||
| 59 | return false; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return $this|AbstractMethod |
||
| 64 | * @throws \Httpful\Exception\ConnectionErrorException |
||
| 65 | * @throws \Pagantis\OrdersApiClient\Exception\HttpException |
||
| 66 | */ |
||
| 67 | public function call() |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * prepareRequest |
||
| 75 | */ |
||
| 76 | public function prepareRequest() |
||
| 90 |