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 |
|
if ($this->checkAllIntegers($progressiveLegsMin, $progressiveLegsMax)) { |
102
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
103
|
4 |
|
$progressiveLegsMin, |
104
|
2 |
|
UnitNumberDetail::TYPE_MINIMUM_PROGRESSIVE_CONNECTIONS |
105
|
2 |
|
); |
106
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
107
|
4 |
|
$progressiveLegsMax, |
108
|
2 |
|
UnitNumberDetail::TYPE_MAXIMUM_PROGRESSIVE_CONNECTIONS |
109
|
2 |
|
); |
110
|
2 |
|
} |
111
|
|
|
|
112
|
48 |
|
if (is_int($maxLayoverPerConnectionHours)) { |
113
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
114
|
4 |
|
$maxLayoverPerConnectionHours, |
115
|
2 |
|
UnitNumberDetail::TYPE_MAX_LAYOVER_PER_CONNECTION_REQUESTED_SEGMENT_HOURS |
116
|
2 |
|
); |
117
|
2 |
|
} |
118
|
|
|
|
119
|
48 |
|
if (is_int($maxLayoverPerConnectionMinutes)) { |
120
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
121
|
4 |
|
$maxLayoverPerConnectionMinutes, |
122
|
2 |
|
UnitNumberDetail::TYPE_MAX_LAYOVER_PER_CONNECTION_REQUESTED_SEGMENT_MINUTES |
123
|
2 |
|
); |
124
|
2 |
|
} |
125
|
|
|
|
126
|
48 |
|
if ($noAirportChange === true) { |
127
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
128
|
4 |
|
1, |
129
|
2 |
|
UnitNumberDetail::TYPE_NO_AIRPORT_CHANGE |
130
|
2 |
|
); |
131
|
2 |
|
} |
132
|
|
|
|
133
|
48 |
|
if (is_int($maxElapsedFlyingTime)) { |
134
|
4 |
|
$this->unitNumberDetail[] = new UnitNumberDetail( |
135
|
4 |
|
$maxElapsedFlyingTime, |
136
|
2 |
|
UnitNumberDetail::TYPE_PERCENTAGE_OF_SHORTEST_ELAPSED_FLYING_TIME |
137
|
2 |
|
); |
138
|
2 |
|
} |
139
|
48 |
|
} |
140
|
|
|
} |
141
|
|
|
|