1 | <?php |
||
8 | class AirlineUpdate extends AbstractAirline |
||
9 | { |
||
10 | |||
11 | const UPDATE_TYPE_DELAY = 'delay'; |
||
12 | const UPDATE_TYPE_GATE_CHANGE = 'gate_change'; |
||
13 | const UPDATE_TYPE_CANCELLATION = 'cancellation'; |
||
14 | |||
15 | /** |
||
16 | * @var null|string |
||
17 | */ |
||
18 | protected $introMessage; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $updateType; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $pnrNumber; |
||
29 | |||
30 | /** |
||
31 | * @var \Kerox\Messenger\Model\Message\Attachment\Template\Airline\FlightInfo |
||
32 | */ |
||
33 | protected $updateFlightInfo; |
||
34 | |||
35 | /** |
||
36 | * AirlineUpdate constructor. |
||
37 | * |
||
38 | * @param string $updateType |
||
39 | * @param string $locale |
||
40 | * @param string $pnrNumber |
||
41 | * @param \Kerox\Messenger\Model\Message\Attachment\Template\Airline\FlightInfo $updateFlightInfo |
||
42 | */ |
||
43 | 1 | public function __construct(string $updateType, string $locale, string $pnrNumber, FlightInfo $updateFlightInfo) |
|
53 | |||
54 | /** |
||
55 | * @param string $introMessage |
||
56 | * @return AirlineUpdate |
||
57 | */ |
||
58 | 1 | public function setIntroMessage($introMessage): AirlineUpdate |
|
64 | |||
65 | /** |
||
66 | * @param string $updateType |
||
67 | * @return void |
||
68 | * @throws \InvalidArgumentException |
||
69 | */ |
||
70 | 1 | private function isValidUpdateType(string $updateType) |
|
71 | { |
||
72 | 1 | $allowedUpdateType = $this->getAllowedUpdateType(); |
|
73 | 1 | if (!in_array($updateType, $allowedUpdateType)) { |
|
74 | throw new \InvalidArgumentException('Allowed values for $updateType are: ' . implode(',', $allowedUpdateType)); |
||
75 | } |
||
76 | 1 | } |
|
77 | |||
78 | /** |
||
79 | * @return array |
||
80 | */ |
||
81 | 1 | private function getAllowedUpdateType(): array |
|
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | 1 | public function jsonSerialize(): array |
|
109 | } |
||
110 |