Completed
Push — master ( 0b0e41...92762b )
by Dieter
06:46
created

TravelerInformation::__construct()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.2
c 0
b 0
f 0
cc 4
eloc 7
nc 2
nop 1
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\Air\RetrieveSeatMap;
24
25
use Amadeus\Client\RequestOptions\Air\RetrieveSeatMap\Traveller as TravellerOpt;
26
use Amadeus\Client\Struct\Air\MultiAvailability\OtherPaxDetails;
27
use Amadeus\Client\Struct\Air\MultiAvailability\PaxDetails;
28
29
/**
30
 * TravelerInformation
31
 *
32
 * @package Amadeus\Client\Struct\Air\RetrieveSeatMap
33
 * @author Dieter Devlieghere <[email protected]>
34
 */
35
class TravelerInformation
36
{
37
    /**
38
     * @var PaxDetails
39
     */
40
    public $paxDetails;
41
42
    /**
43
     * @var OtherPaxDetails[]
44
     */
45
    public $otherPaxDetails = [];
46
47
    /**
48
     * TravelerInformation constructor.
49
     *
50
     * @param TravellerOpt $travellerOpt
51
     */
52
    public function __construct($travellerOpt)
53
    {
54
        $this->paxDetails = new PaxDetails($travellerOpt->lastName);
55
        $this->paxDetails->quantity = 1;
56
57
        if (!empty($travellerOpt->firstName) || !empty($travellerOpt->type) || !empty($travellerOpt->uniqueId)) {
58
            $this->otherPaxDetails[] = new OtherPaxDetails($travellerOpt->firstName);
59
            $this->otherPaxDetails[0]->type = $travellerOpt->type;
60
            $this->otherPaxDetails[0]->uniqueCustomerIdentifier = $travellerOpt->uniqueId;
0 ignored issues
show
Documentation Bug introduced by
The property $uniqueCustomerIdentifier was declared of type string, but $travellerOpt->uniqueId is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
61
        }
62
    }
63
}
64