|
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\MasterPricer; |
|
24
|
|
|
|
|
25
|
|
|
use Amadeus\Client\Struct\WsMessageUtility; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* TravelFlightInfo |
|
29
|
|
|
* |
|
30
|
|
|
* @package Amadeus\Client\Struct\Fare\MasterPricer |
|
31
|
|
|
*/ |
|
32
|
|
|
class TravelFlightInfo extends WsMessageUtility |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var CabinId |
|
36
|
|
|
*/ |
|
37
|
|
|
public $cabinId; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var CompanyIdentity[] |
|
41
|
|
|
*/ |
|
42
|
|
|
public $companyIdentity = []; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var FlightDetail |
|
46
|
|
|
*/ |
|
47
|
|
|
public $flightDetail; |
|
48
|
|
|
|
|
49
|
|
|
public $inclusionDetail = []; |
|
50
|
|
|
|
|
51
|
|
|
public $exclusionDetail = []; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var UnitNumberDetail[] |
|
55
|
|
|
*/ |
|
56
|
|
|
public $unitNumberDetail = []; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* TravelFlightInfo constructor. |
|
60
|
|
|
* |
|
61
|
|
|
* @param string|null $cabinCode CabinId::CABIN_* |
|
62
|
|
|
* @param string|null $cabinOption CabinId::CABINOPT_* |
|
63
|
|
|
* @param string[]|null $flightTypes |
|
64
|
|
|
* @param array|null $airlineOptions |
|
65
|
|
|
* @param int|null $progressiveLegsMin |
|
66
|
|
|
* @param int|null $progressiveLegsMax |
|
67
|
|
|
* @param int|null $maxLayoverPerConnectionHours |
|
68
|
|
|
* @param int|null $maxLayoverPerConnectionMinutes |
|
69
|
|
|
* @param bool|null $noAirportChange |
|
70
|
|
|
* @param int|null $maxElapsedFlyingTime |
|
71
|
|
|
*/ |
|
72
|
48 |
|
public function __construct( |
|
73
|
|
|
$cabinCode = null, |
|
74
|
|
|
$cabinOption = null, |
|
75
|
|
|
$flightTypes = null, |
|
76
|
|
|
$airlineOptions = null, |
|
77
|
|
|
$progressiveLegsMin = null, |
|
78
|
|
|
$progressiveLegsMax = null, |
|
79
|
|
|
$maxLayoverPerConnectionHours = null, |
|
80
|
|
|
$maxLayoverPerConnectionMinutes = null, |
|
81
|
|
|
$noAirportChange = null, |
|
82
|
|
|
$maxElapsedFlyingTime = null |
|
83
|
|
|
) { |
|
84
|
48 |
|
if (!is_null($cabinCode) || !is_null($cabinOption)) { |
|
85
|
8 |
|
$this->cabinId = new CabinId($cabinCode, $cabinOption); |
|
86
|
4 |
|
} |
|
87
|
|
|
|
|
88
|
48 |
|
if (is_array($flightTypes)) { |
|
89
|
48 |
|
$this->flightDetail = new FlightDetail($flightTypes); |
|
90
|
24 |
|
} |
|
91
|
|
|
|
|
92
|
48 |
|
if (!empty($airlineOptions)) { |
|
93
|
8 |
|
foreach ($airlineOptions as $qualifier => $airlines) { |
|
94
|
8 |
|
$this->companyIdentity[] = new CompanyIdentity( |
|
95
|
8 |
|
$qualifier, |
|
96
|
4 |
|
$airlines |
|
97
|
4 |
|
); |
|
98
|
4 |
|
} |
|
99
|
4 |
|
} |
|
100
|
|
|
|
|
101
|
48 |
|
$this->loadUnitNumberDetails( |
|
102
|
48 |
|
$progressiveLegsMin, |
|
103
|
48 |
|
$progressiveLegsMax, |
|
104
|
48 |
|
$maxLayoverPerConnectionHours, |
|
105
|
48 |
|
$maxLayoverPerConnectionMinutes, |
|
106
|
48 |
|
$noAirportChange, |
|
107
|
24 |
|
$maxElapsedFlyingTime |
|
108
|
24 |
|
); |
|
109
|
48 |
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param int|null $progressiveLegsMin |
|
113
|
|
|
* @param int|null $progressiveLegsMax |
|
114
|
|
|
* @param int|null $maxLayoverPerConnectionHours |
|
115
|
|
|
* @param int|null $maxLayoverPerConnectionMinutes |
|
116
|
|
|
* @param bool|null $noAirportChange |
|
117
|
|
|
* @param int|null $maxElapsedFlyingTime |
|
118
|
|
|
*/ |
|
119
|
48 |
|
protected function loadUnitNumberDetails( |
|
120
|
|
|
$progressiveLegsMin, |
|
121
|
|
|
$progressiveLegsMax, |
|
122
|
|
|
$maxLayoverPerConnectionHours, |
|
123
|
|
|
$maxLayoverPerConnectionMinutes, |
|
124
|
|
|
$noAirportChange, |
|
125
|
|
|
$maxElapsedFlyingTime |
|
126
|
|
|
) { |
|
127
|
48 |
|
if ($this->checkAllIntegers($progressiveLegsMin, $progressiveLegsMax)) { |
|
128
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
|
129
|
4 |
|
$progressiveLegsMin, |
|
130
|
2 |
|
UnitNumberDetail::TYPE_MINIMUM_PROGRESSIVE_CONNECTIONS |
|
131
|
2 |
|
); |
|
132
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
|
133
|
4 |
|
$progressiveLegsMax, |
|
134
|
2 |
|
UnitNumberDetail::TYPE_MAXIMUM_PROGRESSIVE_CONNECTIONS |
|
135
|
2 |
|
); |
|
136
|
2 |
|
} |
|
137
|
|
|
|
|
138
|
48 |
|
if (is_int($maxLayoverPerConnectionHours)) { |
|
139
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
|
140
|
4 |
|
$maxLayoverPerConnectionHours, |
|
141
|
2 |
|
UnitNumberDetail::TYPE_MAX_LAYOVER_PER_CONNECTION_REQUESTED_SEGMENT_HOURS |
|
142
|
2 |
|
); |
|
143
|
2 |
|
} |
|
144
|
|
|
|
|
145
|
48 |
|
if (is_int($maxLayoverPerConnectionMinutes)) { |
|
146
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
|
147
|
4 |
|
$maxLayoverPerConnectionMinutes, |
|
148
|
2 |
|
UnitNumberDetail::TYPE_MAX_LAYOVER_PER_CONNECTION_REQUESTED_SEGMENT_MINUTES |
|
149
|
2 |
|
); |
|
150
|
2 |
|
} |
|
151
|
|
|
|
|
152
|
48 |
|
if ($noAirportChange === true) { |
|
153
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
|
154
|
4 |
|
1, |
|
155
|
2 |
|
UnitNumberDetail::TYPE_NO_AIRPORT_CHANGE |
|
156
|
2 |
|
); |
|
157
|
2 |
|
} |
|
158
|
|
|
|
|
159
|
48 |
|
if (is_int($maxElapsedFlyingTime)) { |
|
160
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
|
161
|
4 |
|
$maxElapsedFlyingTime, |
|
162
|
2 |
|
UnitNumberDetail::TYPE_PERCENTAGE_OF_SHORTEST_ELAPSED_FLYING_TIME |
|
163
|
2 |
|
); |
|
164
|
2 |
|
} |
|
165
|
48 |
|
} |
|
166
|
|
|
} |
|
167
|
|
|
|