1 | <?php |
||
33 | class SeatRequest |
||
34 | { |
||
35 | /** |
||
36 | * @var Seat |
||
37 | */ |
||
38 | public $seat; |
||
39 | |||
40 | /** |
||
41 | * @var Special[] |
||
42 | */ |
||
43 | public $special = []; |
||
44 | |||
45 | /** |
||
46 | * SeatRequest constructor. |
||
47 | * |
||
48 | * @param SeatRequestOpt $seatReq |
||
49 | */ |
||
50 | 12 | public function __construct($seatReq) |
|
51 | { |
||
52 | 12 | if (!empty($seatReq->type)) { |
|
53 | 3 | $this->seat = new Seat($seatReq->type); |
|
54 | } |
||
55 | |||
56 | 12 | if (!empty($seatReq->specialType)) { |
|
57 | 3 | $this->special[] = new Special(null, $seatReq->specialType); |
|
58 | } |
||
59 | |||
60 | 12 | if (!empty($seatReq->seatNumber)) { |
|
61 | 6 | if (is_array($seatReq->seatNumber)) { |
|
62 | 3 | foreach ($seatReq->seatNumber as $seatNumber) { |
|
63 | 3 | $this->addSpecial($seatNumber); |
|
64 | } |
||
65 | } else { |
||
66 | 3 | $this->addSpecial($seatReq->seatNumber); |
|
67 | } |
||
68 | } |
||
69 | 12 | } |
|
70 | |||
71 | 6 | protected function addSpecial($seatNumber) |
|
75 | } |
||
76 |