|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* amadeus-ws-client |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright 2015 Amadeus Benelux NV |
|
6
|
|
|
* |
|
7
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
8
|
|
|
* you may not use this file except in compliance with the License. |
|
9
|
|
|
* You may obtain a copy of the License at |
|
10
|
|
|
* |
|
11
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
12
|
|
|
* |
|
13
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
14
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
15
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16
|
|
|
* See the License for the specific language governing permissions and |
|
17
|
|
|
* limitations under the License. |
|
18
|
|
|
* |
|
19
|
|
|
* @package Amadeus |
|
20
|
|
|
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace Amadeus\Client\Struct\Fare; |
|
24
|
|
|
|
|
25
|
|
|
use Amadeus\Client\RequestOptions\Fare\MPFareFamily; |
|
26
|
|
|
use Amadeus\Client\RequestOptions\Fare\MPItinerary; |
|
27
|
|
|
use Amadeus\Client\RequestOptions\FareMasterPricerCalendarOptions; |
|
28
|
|
|
use Amadeus\Client\RequestOptions\FareMasterPricerExSearch; |
|
29
|
|
|
use Amadeus\Client\RequestOptions\TicketAtcShopperMpTbSearchOptions; |
|
30
|
|
|
use Amadeus\Client\Struct\Fare\MasterPricer; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Fare_MasterPricerExpertSearch message structure |
|
34
|
|
|
* |
|
35
|
|
|
* @package Amadeus\Client\Struct\Fare |
|
36
|
|
|
* @author Dieter Devlieghere <[email protected]> |
|
37
|
|
|
*/ |
|
38
|
|
|
class MasterPricerExpertSearch extends BaseMasterPricerMessage |
|
39
|
|
|
{ |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var mixed |
|
43
|
|
|
*/ |
|
44
|
|
|
public $globalOptions; |
|
45
|
|
|
/** |
|
46
|
|
|
* @var MasterPricer\CustomerRef |
|
47
|
|
|
*/ |
|
48
|
|
|
public $customerRef; |
|
49
|
|
|
/** |
|
50
|
|
|
* @var mixed |
|
51
|
|
|
*/ |
|
52
|
|
|
public $formOfPaymentByPassenger; |
|
53
|
|
|
/** |
|
54
|
|
|
* @var mixed |
|
55
|
|
|
*/ |
|
56
|
|
|
public $solutionFamily; |
|
57
|
|
|
/** |
|
58
|
|
|
* @var mixed[] |
|
59
|
|
|
*/ |
|
60
|
|
|
public $passengerInfoGrp = []; |
|
61
|
|
|
/** |
|
62
|
|
|
* @var MasterPricer\FareFamilies[] |
|
63
|
|
|
*/ |
|
64
|
|
|
public $fareFamilies = []; |
|
65
|
|
|
/** |
|
66
|
|
|
* @var MasterPricer\PriceToBeat |
|
67
|
|
|
*/ |
|
68
|
|
|
public $priceToBeat; |
|
69
|
|
|
/** |
|
70
|
|
|
* @var mixed |
|
71
|
|
|
*/ |
|
72
|
|
|
public $taxInfo; |
|
73
|
|
|
/** |
|
74
|
|
|
* @var MasterPricer\TravelFlightInfo |
|
75
|
|
|
*/ |
|
76
|
|
|
public $travelFlightInfo; |
|
77
|
|
|
/** |
|
78
|
|
|
* @var array |
|
79
|
|
|
*/ |
|
80
|
|
|
public $valueSearch = []; |
|
81
|
|
|
/** |
|
82
|
|
|
* Itinerary |
|
83
|
|
|
* |
|
84
|
|
|
* @var MasterPricer\Itinerary[] |
|
85
|
|
|
*/ |
|
86
|
|
|
public $itinerary = []; |
|
87
|
|
|
/** |
|
88
|
|
|
* @var mixed |
|
89
|
|
|
*/ |
|
90
|
|
|
public $ticketChangeInfo; |
|
91
|
|
|
/** |
|
92
|
|
|
* @var mixed |
|
93
|
|
|
*/ |
|
94
|
|
|
public $combinationFareFamilies; |
|
95
|
|
|
/** |
|
96
|
|
|
* @var MasterPricer\FeeOption[] |
|
97
|
|
|
*/ |
|
98
|
|
|
public $feeOption; |
|
99
|
|
|
/** |
|
100
|
|
|
* @var MasterPricer\OfficeIdDetails[] |
|
101
|
|
|
*/ |
|
102
|
|
|
public $officeIdDetails; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* MasterPricerExpertSearch constructor. |
|
106
|
|
|
* |
|
107
|
|
|
* @param FareMasterPricerExSearch|FareMasterPricerCalendarOptions|TicketAtcShopperMpExSearchOptions|null $options |
|
108
|
|
|
*/ |
|
109
|
|
|
public function __construct($options = null) |
|
110
|
|
|
{ |
|
111
|
|
|
if ($options instanceof FareMasterPricerExSearch) { |
|
|
|
|
|
|
112
|
|
|
$this->loadOptions($options); |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @param FareMasterPricerExSearch|FareMasterPricerCalendarOptions|TicketAtcShopperMpExSearchOptions $options |
|
118
|
|
|
*/ |
|
119
|
|
|
protected function loadOptions($options) |
|
120
|
|
|
{ |
|
121
|
|
|
$this->loadNumberOfUnits($options); |
|
122
|
|
|
|
|
123
|
|
|
$this->loadFareOptions($options); |
|
124
|
|
|
|
|
125
|
|
|
$passengerCounter = 1; |
|
126
|
|
|
$infantCounter = 1; |
|
127
|
|
|
foreach ($options->passengers as $passenger) { |
|
128
|
|
|
$this->loadPassenger($passenger, $passengerCounter, $infantCounter); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
$segmentCounter = 1; |
|
132
|
|
|
foreach ($options->itinerary as $itinerary) { |
|
133
|
|
|
$this->loadItinerary($itinerary, $segmentCounter); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
foreach ($options->officeIds as $officeId) { |
|
137
|
|
|
$this->loadOfficeId($officeId); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
View Code Duplication |
if ($this->checkAnyNotEmpty( |
|
|
|
|
|
|
141
|
|
|
$options->cabinClass, |
|
142
|
|
|
$options->cabinOption, |
|
143
|
|
|
$options->requestedFlightTypes, |
|
144
|
|
|
$options->airlineOptions, |
|
145
|
|
|
$options->progressiveLegsMin, |
|
146
|
|
|
$options->progressiveLegsMax, |
|
147
|
|
|
$options->maxLayoverPerConnectionHours, |
|
148
|
|
|
$options->maxLayoverPerConnectionMinutes |
|
149
|
|
|
)) { |
|
150
|
|
|
$this->travelFlightInfo = new MasterPricer\TravelFlightInfo( |
|
151
|
|
|
$options->cabinClass, |
|
152
|
|
|
$options->cabinOption, |
|
153
|
|
|
$options->requestedFlightTypes, |
|
154
|
|
|
$options->airlineOptions, |
|
155
|
|
|
$options->progressiveLegsMin, |
|
156
|
|
|
$options->progressiveLegsMax, |
|
157
|
|
|
$options->maxLayoverPerConnectionHours, |
|
158
|
|
|
$options->maxLayoverPerConnectionMinutes |
|
159
|
|
|
); |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
if (!empty($options->priceToBeat)) { |
|
163
|
|
|
$this->priceToBeat = new MasterPricer\PriceToBeat( |
|
164
|
|
|
$options->priceToBeat, |
|
165
|
|
|
$options->priceToBeatCurrency |
|
166
|
|
|
); |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
$this->loadFareFamilies($options->fareFamilies); |
|
170
|
|
|
|
|
171
|
|
|
$this->loadCustomerRefs($options->dkNumber); |
|
172
|
|
|
|
|
173
|
|
|
$this->loadFeeOptions($options->feeOption); |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @param string $officeId |
|
178
|
|
|
*/ |
|
179
|
|
|
protected function loadOfficeId($officeId) |
|
180
|
|
|
{ |
|
181
|
|
|
$this->officeIdDetails[] = new MasterPricer\OfficeIdDetails($officeId); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @param MPItinerary $itineraryOptions |
|
186
|
|
|
* @param int $counter BYREF |
|
187
|
|
|
*/ |
|
188
|
|
|
protected function loadItinerary($itineraryOptions, &$counter) |
|
189
|
|
|
{ |
|
190
|
|
|
$segmentRef = $counter; |
|
191
|
|
|
|
|
192
|
|
|
if (!empty($itineraryOptions->segmentReference)) { |
|
193
|
|
|
$segmentRef = $itineraryOptions->segmentReference; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
$tmpItinerary = new MasterPricer\Itinerary($segmentRef); |
|
197
|
|
|
|
|
198
|
|
|
$tmpItinerary->departureLocalization = new MasterPricer\DepartureLocalization( |
|
199
|
|
|
$itineraryOptions->departureLocation |
|
200
|
|
|
); |
|
201
|
|
|
$tmpItinerary->arrivalLocalization = new MasterPricer\ArrivalLocalization( |
|
202
|
|
|
$itineraryOptions->arrivalLocation |
|
203
|
|
|
); |
|
204
|
|
|
$tmpItinerary->timeDetails = new MasterPricer\TimeDetails($itineraryOptions->date); |
|
205
|
|
|
|
|
206
|
|
|
$this->itinerary[] = $tmpItinerary; |
|
207
|
|
|
|
|
208
|
|
|
$counter++; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* @param MPFareFamily[] $fareFamilies |
|
213
|
|
|
*/ |
|
214
|
|
|
protected function loadFareFamilies($fareFamilies) |
|
215
|
|
|
{ |
|
216
|
|
|
foreach ($fareFamilies as $fareFamily) { |
|
217
|
|
|
$this->fareFamilies[] = new MasterPricer\FareFamilies($fareFamily); |
|
218
|
|
|
} |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* Load Customer references |
|
223
|
|
|
* |
|
224
|
|
|
* @param string $dkNumber |
|
225
|
|
|
*/ |
|
226
|
|
View Code Duplication |
protected function loadCustomerRefs($dkNumber) |
|
|
|
|
|
|
227
|
|
|
{ |
|
228
|
|
|
if (!is_null($dkNumber)) { |
|
229
|
|
|
$this->customerRef = new MasterPricer\CustomerRef(); |
|
230
|
|
|
$this->customerRef->customerReferences[] = new MasterPricer\CustomerReferences( |
|
231
|
|
|
$dkNumber, |
|
232
|
|
|
MasterPricer\CustomerReferences::QUAL_AGENCY_GROUPING_ID |
|
233
|
|
|
); |
|
234
|
|
|
} |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
private function loadFeeOptions($feeOptions) |
|
238
|
|
|
{ |
|
239
|
|
|
if (!is_null($feeOptions)) { |
|
240
|
|
|
foreach ($feeOptions as $feeOption) { |
|
241
|
|
|
$this->feeOption[] = new MasterPricer\FeeOption($feeOption); |
|
242
|
|
|
} |
|
243
|
|
|
} |
|
244
|
|
|
} |
|
245
|
|
|
} |
|
246
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.