Completed
Push — master ( 1ecee2...1e59ec )
by Dieter
07:27
created

FareOptions::__construct()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.2
c 0
b 0
f 0
cc 4
eloc 10
nc 6
nop 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
/**
26
 * FareOptions
27
 *
28
 * @package Amadeus\Client\Struct\Fare\MasterPricer
29
 * @author Dieter Devlieghere <[email protected]>
30
 */
31
class FareOptions
32
{
33
    /**
34
     * @var PricingTickInfo
35
     */
36
    public $pricingTickInfo;
37
    /**
38
     * @var Corporate
39
     */
40
    public $corporate;
41
42
    public $ticketingPriceScheme;
43
    /**
44
     * @var FeeIdDescription
45
     */
46
    public $feeIdDescription;
47
    /**
48
     * @var ConversionRate
49
     */
50
    public $conversionRate;
51
52
    public $formOfPayment;
53
54
    public $frequentTravellerInfo;
55
56
    public $monetaryCabinInfo;
57
58
    /**
59
     * FareOptions constructor.
60
     *
61
     * @param array $flightOptions List of flight / fare options
62
     * @param array $corpCodesUniFares list of Corporate codes for Corporate Unifares
63
     * @param bool $tickPreCheck Do Ticketability pre-check?
64
     */
65
    public function __construct(array $flightOptions, array $corpCodesUniFares, $tickPreCheck)
66
    {
67
        $this->pricingTickInfo = new PricingTickInfo();
68
        $this->pricingTickInfo->pricingTicketing = new PricingTicketing();
69
70
        if ($tickPreCheck === true) {
71
            $this->pricingTickInfo->pricingTicketing->priceType[] = PricingTicketing::PRICETYPE_TICKETABILITY_PRECHECK;
72
        }
73
74
        foreach ($flightOptions as $flightOption) {
75
            $this->pricingTickInfo->pricingTicketing->priceType[] = $flightOption;
76
77
            if ($flightOption === PricingTicketing::PRICETYPE_CORPORATE_UNIFARES) {
78
                $this->corporate = new Corporate();
79
                $this->corporate->corporateId[] = new CorporateId($corpCodesUniFares);
80
            }
81
        }
82
    }
83
}
84