| @@ 8-51 (lines=44) @@ | ||
| 5 | use DateTime; |
|
| 6 | use HelePartnerSyncApi\Validator; |
|
| 7 | ||
| 8 | class CancelReservation extends Method |
|
| 9 | { |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @return string |
|
| 13 | */ |
|
| 14 | public function getName() |
|
| 15 | { |
|
| 16 | return 'cancelReservation'; |
|
| 17 | } |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @param array $data |
|
| 21 | * @return array |
|
| 22 | */ |
|
| 23 | protected function constructRequestData($data) |
|
| 24 | { |
|
| 25 | Validator::checkStructure($data, array( |
|
| 26 | 'startDateTime' => Validator::TYPE_DATE_TIME_STRING, |
|
| 27 | 'endDateTime' => Validator::TYPE_DATE_TIME_STRING, |
|
| 28 | 'quantity' => Validator::TYPE_INT, |
|
| 29 | 'parameters' => Validator::TYPE_ARRAY, |
|
| 30 | )); |
|
| 31 | ||
| 32 | return array( |
|
| 33 | DateTime::createFromFormat(DateTime::W3C, $data['startDateTime']), |
|
| 34 | DateTime::createFromFormat(DateTime::W3C, $data['endDateTime']), |
|
| 35 | $data['quantity'], |
|
| 36 | $data['parameters'], |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param mixed $data |
|
| 42 | * @return array |
|
| 43 | */ |
|
| 44 | protected function constructResponseData($data) |
|
| 45 | { |
|
| 46 | Validator::checkNull($data); |
|
| 47 | ||
| 48 | return array(); |
|
| 49 | } |
|
| 50 | ||
| 51 | } |
|
| 52 | ||
| @@ 8-51 (lines=44) @@ | ||
| 5 | use DateTime; |
|
| 6 | use HelePartnerSyncApi\Validator; |
|
| 7 | ||
| 8 | class CreateReservation extends Method |
|
| 9 | { |
|
| 10 | ||
| 11 | /** |
|
| 12 | * @return string |
|
| 13 | */ |
|
| 14 | public function getName() |
|
| 15 | { |
|
| 16 | return 'createReservation'; |
|
| 17 | } |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @param array $data |
|
| 21 | * @return array |
|
| 22 | */ |
|
| 23 | protected function constructRequestData($data) |
|
| 24 | { |
|
| 25 | Validator::checkStructure($data, array( |
|
| 26 | 'startDateTime' => Validator::TYPE_DATE_TIME_STRING, |
|
| 27 | 'endDateTime' => Validator::TYPE_DATE_TIME_STRING, |
|
| 28 | 'quantity' => Validator::TYPE_INT, |
|
| 29 | 'parameters' => Validator::TYPE_ARRAY, |
|
| 30 | )); |
|
| 31 | ||
| 32 | return array( |
|
| 33 | DateTime::createFromFormat(DateTime::W3C, $data['startDateTime']), |
|
| 34 | DateTime::createFromFormat(DateTime::W3C, $data['endDateTime']), |
|
| 35 | $data['quantity'], |
|
| 36 | $data['parameters'], |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param mixed $data |
|
| 42 | * @return array |
|
| 43 | */ |
|
| 44 | protected function constructResponseData($data) |
|
| 45 | { |
|
| 46 | Validator::checkNull($data); |
|
| 47 | ||
| 48 | return array(); |
|
| 49 | } |
|
| 50 | ||
| 51 | } |
|
| 52 | ||