| Total Complexity | 7 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class CreateOrderMethod extends AbstractMethod |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * Get Order Endpoint |
||
| 21 | */ |
||
| 22 | const ENDPOINT = '/orders'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var Order |
||
| 26 | */ |
||
| 27 | protected $order; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param Order $order |
||
| 31 | * |
||
| 32 | * @return $this |
||
| 33 | */ |
||
| 34 | public function setOrder(Order $order) |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return $this|AbstractMethod |
||
| 43 | * @throws \Httpful\Exception\ConnectionErrorException |
||
| 44 | * @throws ClientException |
||
| 45 | * @throws \Pagantis\OrdersApiClient\Exception\HttpException |
||
| 46 | */ |
||
| 47 | public function call() |
||
| 48 | { |
||
| 49 | if ($this->order instanceof Order) { |
||
|
|
|||
| 50 | $this->prepareRequest(); |
||
| 51 | return $this->setResponse($this->request->send()); |
||
| 52 | } |
||
| 53 | throw new ClientException('Please Set Order'); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return bool|Order |
||
| 58 | */ |
||
| 59 | public function getOrder() |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * prepareRequest |
||
| 73 | * |
||
| 74 | */ |
||
| 75 | protected function prepareRequest() |
||
| 86 | ; |
||
| 87 | } |
||
| 90 |