Completed
Push — master ( 0fe829...fb702c )
by Dieter
08:08
created

Fare::createFareCheckRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
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\RequestCreator;
24
25
use Amadeus\Client\RequestOptions\FareCheckRulesOptions;
26
use Amadeus\Client\RequestOptions\FareConvertCurrencyOptions;
27
use Amadeus\Client\RequestOptions\FareInformativeBestPricingWithoutPnrOptions;
28
use Amadeus\Client\RequestOptions\FareInformativePricingWithoutPnrOptions;
29
use Amadeus\Client\RequestOptions\FareMasterPricerCalendarOptions;
30
use Amadeus\Client\RequestOptions\FareMasterPricerTbSearch;
31
use Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions;
32
use Amadeus\Client\RequestOptions\FarePricePnrWithLowerFaresOptions;
33
use Amadeus\Client\RequestOptions\FarePricePnrWithLowestFareOptions;
34
use Amadeus\Client\Struct;
35
36
/**
37
 * Fare Request Creator
38
 *
39
 * Responsible for creating all "Fare_" messages
40
 *
41
 * methods for creation must have the correct name
42
 * 'create'<message name without underscores>
43
 *
44
 * @package Amadeus\Client\RequestCreator
45
 * @author Dieter Devlieghere <[email protected]>
46
 */
47
class Fare
48
{
49
    /**
50
     * createFareMasterPricerTravelBoardSearch
51
     *
52
     * @param FareMasterPricerTbSearch $params
53
     * @return Struct\Fare\MasterPricerTravelBoardSearch
54
     */
55
    public function createFareMasterPricerTravelBoardSearch(FareMasterPricerTbSearch $params)
56
    {
57
        return new Struct\Fare\MasterPricerTravelBoardSearch($params);
58
    }
59
60
    /**
61
     * createFareMasterPricerCalendar
62
     *
63
     * @param FareMasterPricerCalendarOptions $params
64
     * @return Struct\Fare\MasterPricerCalendar
65
     */
66
    public function createFareMasterPricerCalendar(FareMasterPricerCalendarOptions $params)
67
    {
68
        return new Struct\Fare\MasterPricerCalendar($params);
69
    }
70
71
72
    /**
73
     * createFareCheckRules
74
     *
75
     * @param FareCheckRulesOptions $params
76
     * @return Struct\Fare\CheckRules
77
     */
78
    public function createFareCheckRules(FareCheckRulesOptions $params)
79
    {
80
        return new Struct\Fare\CheckRules($params);
81
    }
82
83
    /**
84
     * createFareConvertCurrency
85
     *
86
     * @param FareConvertCurrencyOptions $params
87
     * @return Struct\Fare\ConvertCurrency
88
     */
89
    public function createFareConvertCurrency(FareConvertCurrencyOptions $params)
90
    {
91
        return new Struct\Fare\ConvertCurrency($params);
92
    }
93
94
    /**
95
     * createFarePricePnrWithBookingClass
96
     *
97
     * @param FarePricePnrWithBookingClassOptions $params
98
     * @param string $version
99
     * @return Struct\Fare\PricePNRWithBookingClass12|Struct\Fare\PricePNRWithBookingClass13
100
     */
101
    public function createFarePricePnrWithBookingClass(FarePricePnrWithBookingClassOptions $params, $version)
102
    {
103
        if ($version < 13) {
104
            return new Struct\Fare\PricePNRWithBookingClass12($params);
105
        } else {
106
            return new Struct\Fare\PricePNRWithBookingClass13($params);
107
        }
108
    }
109
110
    /**
111
     * createFarePricePnrWithLowerFares
112
     *
113
     * @param FarePricePnrWithLowerFaresOptions $params
114
     * @param string $version
115
     * @return Struct\Fare\PricePNRWithLowerFares12|Struct\Fare\PricePNRWithLowerFares13
116
     */
117
    public function createFarePricePnrWithLowerFares(FarePricePnrWithLowerFaresOptions $params, $version)
118
    {
119
        if ($version < 13) {
120
            return new Struct\Fare\PricePNRWithLowerFares12($params);
121
        } else {
122
            return new Struct\Fare\PricePNRWithLowerFares13($params);
123
        }
124
    }
125
126
    /**
127
     * createFarePricePnrWithLowestFare
128
     *
129
     * @param FarePricePnrWithLowestFareOptions $params
130
     * @param string $version
131
     * @return Struct\Fare\PricePNRWithLowestFare12|Struct\Fare\PricePNRWithLowestFare13
132
     */
133
    public function createFarePricePnrWithLowestFare(FarePricePnrWithLowestFareOptions $params, $version)
134
    {
135
        if ($version < 13) {
136
            return new Struct\Fare\PricePNRWithLowestFare12($params);
137
        } else {
138
            return new Struct\Fare\PricePNRWithLowestFare13($params);
139
        }
140
    }
141
142
    /**
143
     * createFareInformativePricingWithoutPNR
144
     *
145
     * @param FareInformativePricingWithoutPnrOptions $params
146
     * @param string $version
147
     * @return Struct\Fare\InformativePricingWithoutPNR12|Struct\Fare\InformativePricingWithoutPNR13
148
     */
149
    public function createFareInformativePricingWithoutPNR(FareInformativePricingWithoutPnrOptions $params, $version)
150
    {
151
        if ($version < 13) {
152
            return new Struct\Fare\InformativePricingWithoutPNR12($params);
153
        } else {
154
            return new Struct\Fare\InformativePricingWithoutPNR13($params);
155
        }
156
    }
157
158
    /**
159
     * createFareInformativeBestPricingWithoutPNR
160
     *
161
     * @param FareInformativeBestPricingWithoutPnrOptions $params
162
     * @param string $version
163
     * @return Struct\Fare\InformativeBestPricingWithoutPNR12|Struct\Fare\InformativeBestPricingWithoutPNR13
164
     */
165
    public function createFareInformativeBestPricingWithoutPNR(
166
        FareInformativeBestPricingWithoutPnrOptions $params,
167
        $version
168
    ) {
169
        if ($version < 13) {
170
            return new Struct\Fare\InformativeBestPricingWithoutPNR12($params);
171
        } else {
172
            return new Struct\Fare\InformativeBestPricingWithoutPNR13($params);
173
        }
174
    }
175
}
176