Completed
Push — master ( 6421a3...9ea2c2 )
by Dieter
06:07
created

PaxSegTstReference::__construct()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 15
c 1
b 1
f 0
rs 8.8571
cc 5
eloc 7
nc 6
nop 2
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\PricePnr13;
24
25
use Amadeus\Client\RequestOptions\Fare\PricePnr\PaxSegRef;
26
27
/**
28
 * PaxSegTstReference
29
 *
30
 * @package Amadeus\Client\Struct\Fare\PricePnr13
31
 * @author Dieter Devlieghere <[email protected]>
32
 */
33
class PaxSegTstReference
34
{
35
    /**
36
     * @var ReferenceDetails[]
37
     */
38
    public $referenceDetails = [];
39
40
    /**
41
     * PaxSegTstReference constructor.
42
     *
43
     * @param array $segmentReference Legacy segment references format
0 ignored issues
show
Documentation introduced by
Should the type for parameter $segmentReference not be array|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
44
     * @param PaxSegRef[]|null $references New segment references format
45
     */
46
    public function __construct($segmentReference = null, $references = null)
47
    {
48
        //Support for legacy segment reference format - to be removed when breaking BC.
49
        if (!empty($segmentReference)) {
50
            foreach ($segmentReference as $segNum => $segQual) {
51
                $this->referenceDetails[] = new ReferenceDetails($segNum, $segQual);
52
            }
53
        }
54
55
        if (!empty($references)) {
56
            foreach ($references as $ref) {
57
                $this->referenceDetails[] = new ReferenceDetails($ref->reference, $ref->type);
58
            }
59
        }
60
    }
61
}
62