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\Pnr\Retrieve; |
24
|
|
|
|
25
|
|
|
use Amadeus\Client\RequestOptions\Pnr\Retrieve\FrequentTraveller; |
26
|
|
|
use Amadeus\Client\RequestOptions\PnrRetrieveOptions; |
27
|
|
|
use Amadeus\Client\Struct\Pnr\Retrieve as RetrieveMsg; |
28
|
|
|
use Amadeus\Client\Struct\WsMessageUtility; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Structure class for the RetrievalFacts message part for PNR_Retrieve messages |
32
|
|
|
* |
33
|
|
|
* @package Amadeus\Client\Struct\Pnr\Retrieve |
34
|
|
|
* @author Dieter Devlieghere <[email protected]> |
35
|
|
|
*/ |
36
|
|
|
class RetrievalFacts extends WsMessageUtility |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* @var Retrieve |
40
|
|
|
*/ |
41
|
|
|
public $retrieve; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var ReservationOrProfileIdentifier |
45
|
|
|
*/ |
46
|
|
|
public $reservationOrProfileIdentifier; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var PersonalFacts |
50
|
|
|
*/ |
51
|
|
|
public $personalFacts; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var FrequentFlyer |
55
|
|
|
*/ |
56
|
|
|
public $frequentFlyer; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var Accounting |
60
|
|
|
*/ |
61
|
|
|
public $accounting; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Construct retrievalFacts element |
65
|
|
|
* |
66
|
|
|
* @param PnrRetrieveOptions $options |
67
|
|
|
*/ |
68
|
23 |
|
public function __construct($options) |
69
|
|
|
{ |
70
|
23 |
|
$this->retrieve = new Retrieve( |
71
|
23 |
|
$options->retrievalType, |
72
|
23 |
|
$options->officeId, $options->options |
73
|
23 |
|
); |
74
|
|
|
|
75
|
23 |
|
if ($this->checkAnyNotEmpty($options->accountNumber)) { |
76
|
1 |
|
$this->accounting = new Accounting($options->accountNumber); |
77
|
1 |
|
} |
78
|
|
|
|
79
|
23 |
|
if ($this->checkAnyNotEmpty($options->recordLocator, $options->customerProfile)) { |
80
|
15 |
|
$controlNumber = ($options->retrievalType == RetrieveMsg::RETR_TYPE_BY_CUSTOMER_PROFILE) ? $options->customerProfile : $options->recordLocator; |
|
|
|
|
81
|
|
|
|
82
|
15 |
|
$this->reservationOrProfileIdentifier = new ReservationOrProfileIdentifier($controlNumber); |
83
|
15 |
|
} |
84
|
|
|
|
85
|
23 |
|
if ($this->checkAnyNotEmpty($options->lastName, $options->departureDate, $options->ticket, $options->company, $options->flightNumber)) { |
|
|
|
|
86
|
4 |
|
$this->personalFacts = new PersonalFacts( |
87
|
4 |
|
$options->lastName, |
88
|
4 |
|
$options->departureDate, |
89
|
4 |
|
$options->ticket, |
90
|
4 |
|
$options->company, |
91
|
4 |
|
$options->flightNumber |
92
|
4 |
|
); |
93
|
4 |
|
} |
94
|
|
|
|
95
|
23 |
|
if ($options->frequentTraveller instanceof FrequentTraveller) { |
96
|
1 |
|
$this->frequentFlyer = new FrequentFlyer($options->frequentTraveller); |
97
|
1 |
|
} |
98
|
23 |
|
} |
99
|
|
|
} |
100
|
|
|
|
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.