@@ 41-112 (lines=72) @@ | ||
38 | * @package Amadeus\Client\Struct\Fare |
|
39 | * @author Dieter Devlieghere <[email protected]> |
|
40 | */ |
|
41 | class InformativePricingWithoutPNR13 extends BaseWsMessage |
|
42 | { |
|
43 | /** |
|
44 | * @var OriginatorGroup |
|
45 | */ |
|
46 | public $originatorGroup; |
|
47 | ||
48 | /** |
|
49 | * @var PassengersGroup[] |
|
50 | */ |
|
51 | public $passengersGroup = []; |
|
52 | ||
53 | /** |
|
54 | * @var SegmentGroup[] |
|
55 | */ |
|
56 | public $segmentGroup = []; |
|
57 | ||
58 | /** |
|
59 | * @var PricingOptionGroup[] |
|
60 | */ |
|
61 | public $pricingOptionGroup = []; |
|
62 | ||
63 | /** |
|
64 | * InformativePricingWithoutPNR13 constructor. |
|
65 | * |
|
66 | * @param FareInformativePricingWithoutPnrOptions|null $options |
|
67 | */ |
|
68 | public function __construct($options) |
|
69 | { |
|
70 | if (!is_null($options)) { |
|
71 | $this->loadPassengers($options->passengers); |
|
72 | ||
73 | $this->loadSegments($options->segments); |
|
74 | ||
75 | $this->loadPricingOptions($options->pricingOptions); |
|
76 | } |
|
77 | } |
|
78 | ||
79 | /** |
|
80 | * @param Passenger[] $passengers |
|
81 | */ |
|
82 | protected function loadPassengers($passengers) |
|
83 | { |
|
84 | $counter = 1; |
|
85 | ||
86 | foreach ($passengers as $passenger) { |
|
87 | $this->passengersGroup[] = new PassengersGroup($passenger, $counter); |
|
88 | $counter++; |
|
89 | } |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * @param Segment[] $segments |
|
94 | */ |
|
95 | protected function loadSegments($segments) |
|
96 | { |
|
97 | foreach ($segments as $segment) { |
|
98 | $this->segmentGroup[] = new SegmentGroup($segment); |
|
99 | } |
|
100 | } |
|
101 | ||
102 | /** |
|
103 | * @param PricingOptions|null $pricingOptions |
|
104 | */ |
|
105 | protected function loadPricingOptions($pricingOptions) |
|
106 | { |
|
107 | if (!($pricingOptions instanceof PricingOptions)) { |
|
108 | $pricingOptions = new PricingOptions(); |
|
109 | } |
|
110 | $this->pricingOptionGroup = PricePNRWithBookingClass13::loadPricingOptionsFromRequestOptions($pricingOptions); |
|
111 | } |
|
112 | } |
|
113 |
@@ 40-107 (lines=68) @@ | ||
37 | * @package Amadeus\Client\Struct\Fare |
|
38 | * @author Valerii Nezhurov <[email protected]> |
|
39 | */ |
|
40 | class PriceUpsellWithoutPNR extends BaseWsMessage |
|
41 | { |
|
42 | /** |
|
43 | * @var PassengersGroup[] |
|
44 | */ |
|
45 | public $passengersGroup = []; |
|
46 | ||
47 | /** |
|
48 | * @var SegmentGroup[] |
|
49 | */ |
|
50 | public $segmentGroup = []; |
|
51 | ||
52 | /** |
|
53 | * @var PricingOptionGroup[] |
|
54 | */ |
|
55 | public $pricingOptionGroup = []; |
|
56 | ||
57 | /** |
|
58 | * PriceUpsellWithoutPNR constructor. |
|
59 | * |
|
60 | * @param FarePriceUpsellWithoutPnrOptions|null $options |
|
61 | */ |
|
62 | public function __construct($options) |
|
63 | { |
|
64 | if ($options === null) { |
|
65 | return; |
|
66 | } |
|
67 | ||
68 | $this->loadPassengers($options->passengers); |
|
69 | $this->loadSegments($options->segments); |
|
70 | $this->loadPricingOptions($options->pricingOptions); |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * @param Passenger[] $passengers |
|
75 | */ |
|
76 | protected function loadPassengers($passengers) |
|
77 | { |
|
78 | $counter = 1; |
|
79 | ||
80 | foreach ($passengers as $passenger) { |
|
81 | $this->passengersGroup[] = new PassengersGroup($passenger, $counter); |
|
82 | $counter++; |
|
83 | } |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * @param Segment[] $segments |
|
88 | */ |
|
89 | protected function loadSegments($segments) |
|
90 | { |
|
91 | foreach ($segments as $segment) { |
|
92 | $this->segmentGroup[] = new SegmentGroup($segment); |
|
93 | } |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * @param PricingOptions|null $pricingOptions |
|
98 | */ |
|
99 | protected function loadPricingOptions($pricingOptions) |
|
100 | { |
|
101 | if (!($pricingOptions instanceof PricingOptions)) { |
|
102 | $pricingOptions = new PricingOptions(); |
|
103 | } |
|
104 | ||
105 | $this->pricingOptionGroup = PricePNRWithBookingClass13::loadPricingOptionsFromRequestOptions($pricingOptions); |
|
106 | } |
|
107 | } |
|
108 |