1 | <?php |
||
10 | class BoardingPassbook extends Passbook |
||
11 | { |
||
12 | protected const TYPE = 'boardingPass'; |
||
13 | |||
14 | private TransitType $transitType; |
||
|
|||
15 | |||
16 | 25 | public function __construct(string $serialNumber, TransitType $transitType = null) |
|
17 | { |
||
18 | 25 | parent::__construct($serialNumber); |
|
19 | |||
20 | 25 | if ($transitType) { |
|
21 | 1 | $this->setTransitType($transitType); |
|
22 | } |
||
23 | 25 | } |
|
24 | |||
25 | |||
26 | 18 | public function setTransitType(TransitType $transitType): void |
|
27 | { |
||
28 | 18 | $this->transitType = $transitType; |
|
29 | 18 | } |
|
30 | |||
31 | /** |
||
32 | * @throws MissingRequiredDataException |
||
33 | */ |
||
34 | 22 | public function validate(): void |
|
35 | { |
||
36 | 22 | parent::validate(); |
|
37 | |||
38 | 18 | if (!isset($this->transitType)) { |
|
39 | 1 | throw new MissingRequiredDataException('Please specify the TransitType before requesting the manifest data.'); |
|
40 | } |
||
41 | 17 | } |
|
42 | |||
43 | /** |
||
44 | * @return array<int|string, mixed> |
||
45 | */ |
||
54 |