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