Completed
Push — master ( 34b639...00cc71 )
by Dieter
05:14
created

FareFamilies::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
ccs 12
cts 12
cp 1
rs 9.4285
cc 3
eloc 8
nc 4
nop 1
crap 3
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\RequestOptions\Fare\MasterPricer\FFCriteria;
26
use Amadeus\Client\RequestOptions\Fare\MPFareFamily;
27
28
/**
29
 * FareFamilies
30
 *
31
 * @package Amadeus\Client\Struct\Fare\MasterPricer
32
 * @author Dieter Devlieghere <[email protected]>
33
 */
34
class FareFamilies
35
{
36
    /**
37
     * @var FamilyInformation
38
     */
39
    public $familyInformation;
40
41
    /**
42
     * @var FamilyCriteria
43
     */
44
    public $familyCriteria;
45
46
    /**
47
     * @var FareFamilySegment[]
48
     */
49
    public $fareFamilySegment = [];
50
51
    /**
52
     * @var OtherPossibleCriteria[]
53
     */
54
    public $otherPossibleCriteria = [];
55
56
    /**
57
     * FareFamilies constructor.
58
     *
59
     * @param MPFareFamily $family
60
     */
61 2
    public function __construct(MPFareFamily $family)
62
    {
63 2
        $this->familyInformation = new FamilyInformation(
64 2
            $family->name,
65 2
            $family->ranking
66 2
        );
67
68 2
        if ($family->criteria instanceof FFCriteria) {
69 2
            $this->familyCriteria = new FamilyCriteria($family->criteria);
70 2
        }
71
72 2
        foreach ($family->otherCriteria as $otherCriteria) {
73 1
            $this->otherPossibleCriteria[] = new OtherPossibleCriteria($otherCriteria);
74 2
        }
75 2
    }
76
}
77