Total Complexity | 7 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class GetOrderMethod extends AbstractMethod |
||
17 | { |
||
18 | /** |
||
19 | * Get Order Endpoint |
||
20 | */ |
||
21 | const ENDPOINT = '/orders'; |
||
22 | |||
23 | /** |
||
24 | * @var string $orderId |
||
25 | */ |
||
26 | protected $orderId; |
||
27 | |||
28 | /** |
||
29 | * @param string $orderId |
||
30 | * |
||
31 | * @return GetOrderMethod |
||
32 | */ |
||
33 | public function setOrderId($orderId) |
||
34 | { |
||
35 | $this->orderId = $orderId; |
||
36 | |||
37 | return $this; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return $this|AbstractMethod |
||
42 | * @throws \Httpful\Exception\ConnectionErrorException |
||
43 | * @throws \Pagantis\OrdersApiClient\Exception\HttpException |
||
44 | * @throws ClientException |
||
45 | */ |
||
46 | public function call() |
||
47 | { |
||
48 | if (is_string($this->orderId)) { |
||
|
|||
49 | $this->prepareRequest(); |
||
50 | return $this->setResponse($this->request->send()); |
||
51 | } |
||
52 | throw new ClientException('Please set OrderId'); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return bool|Order |
||
57 | */ |
||
58 | public function getOrder() |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * prepareRequest |
||
72 | */ |
||
73 | protected function prepareRequest() |
||
83 | ) |
||
84 | ; |
||
85 | } |
||
88 |