Completed
Push — master ( 8f168b...4b1795 )
by Dieter
09:49
created

PricePNRWithBookingClass13::hasPricingGroup()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 2
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;
24
25
use Amadeus\Client\RequestCreator\MessageVersionUnsupportedException;
26
use Amadeus\Client\RequestOptions\Fare\PricePnr\AwardPricing;
27
use Amadeus\Client\RequestOptions\Fare\PricePnr\ExemptTax;
28
use Amadeus\Client\RequestOptions\Fare\PricePnr\FareBasis;
29
use Amadeus\Client\RequestOptions\Fare\PricePnr\ObFee;
30
use Amadeus\Client\RequestOptions\Fare\PricePnr\PaxSegRef;
31
use Amadeus\Client\RequestOptions\Fare\PricePnr\Tax;
32
use Amadeus\Client\RequestOptions\FarePricePnrWithBookingClassOptions;
33
use Amadeus\Client\RequestOptions\FarePricePnrWithLowerFaresOptions as LowerFareOpt;
34
use Amadeus\Client\RequestOptions\FarePricePnrWithLowestFareOptions as LowestFareOpt;
35
use Amadeus\Client\Struct\Fare\PricePnr13\CarrierInformation;
36
use Amadeus\Client\Struct\Fare\PricePnr13\Currency;
37
use Amadeus\Client\Struct\Fare\PricePnr13\DateInformation;
38
use Amadeus\Client\Struct\Fare\PricePnr13\FrequentFlyerInformation;
39
use Amadeus\Client\Struct\Fare\PricePnr13\FrequentTravellerDetails;
40
use Amadeus\Client\Struct\Fare\PricePnr13\LocationInformation;
41
use Amadeus\Client\Struct\Fare\PricePnr13\OptionDetail;
42
use Amadeus\Client\Struct\Fare\PricePnr13\PaxSegTstReference;
43
use Amadeus\Client\Struct\Fare\PricePnr13\PenDisInformation;
44
use Amadeus\Client\Struct\Fare\PricePnr13\PricingOptionGroup;
45
use Amadeus\Client\Struct\Fare\PricePnr13\PricingOptionKey;
46
use Amadeus\Client\Struct\Fare\PricePnr13\TaxData;
47
use Amadeus\Client\Struct\Fare\PricePnr13\TaxInformation;
48
49
/**
50
 * Fare_PricePNRWithBookingClass v 13 and higher structure
51
 *
52
 * @package Amadeus\Client\Struct\Fare
53
 * @author dieter <[email protected]>
54
 */
55
class PricePNRWithBookingClass13 extends BasePricingMessage
56
{
57
    /**
58
     * @var PricePnr13\PricingOptionGroup[]
59
     */
60
    public $pricingOptionGroup = [];
61
62
    /**
63
     * PricePNRWithBookingClass13 constructor.
64
     *
65
     * @param FarePricePnrWithBookingClassOptions|LowerFareOpt|LowestFareOpt|null $options
66
     * @throws MessageVersionUnsupportedException
67
     */
68 21
    public function __construct($options)
69
    {
70 21
        if (!is_null($options)) {
71 21
            $this->pricingOptionGroup = $this->loadPricingOptionsFromRequestOptions($options);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->loadPricingOption...equestOptions($options) of type array<integer,object<Ama...Pricing\PricingOption>> is incompatible with the declared type array<integer,object<Ama...13\PricingOptionGroup>> of property $pricingOptionGroup.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
72 21
        }
73 21
    }
74
75
    /**
76
     * Load an array of PricingOptionGroup objects from the Pricing request options.
77
     *
78
     * Extracted because this method is also used in the InformativePricingWithoutPnr messages.
79
     *
80
     * @param FarePricePnrWithBookingClassOptions|LowerFareOpt|LowestFareOpt $options
81
     * @return PricingOptionGroup[]
0 ignored issues
show
Documentation introduced by
Should the return type not be array<PricingOptionGroup...dPricing\PricingOption>?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
82
     */
83 27
    public static function loadPricingOptionsFromRequestOptions($options)
84
    {
85 27
        $priceOptions = [];
86
87 27
        $priceOptions = self::mergeOptions(
88 27
            $priceOptions,
89 27
            self::makePricingOptionForValidatingCarrier($options->validatingCarrier)
90 27
        );
91
92 27
        $priceOptions = self::mergeOptions(
93 27
            $priceOptions,
94 27
            self::makePricingOptionForCurrencyOverride($options->currencyOverride)
95 27
        );
96
97 27
        $priceOptions = self::mergeOptions(
98 27
            $priceOptions,
99 27
            self::makePricingOptionFareBasisOverride($options->pricingsFareBasis)
100 27
        );
101
102 27
        $priceOptions = self::mergeOptions(
103 27
            $priceOptions,
104 27
            self::loadCorpNegoFare($options->corporateNegoFare)
105 27
        );
106
107 27
        $priceOptions = self::mergeOptions(
108 27
            $priceOptions,
109 27
            self::loadCorpUniFares($options->corporateUniFares, $options->awardPricing)
110 27
        );
111
112 27
        $priceOptions = self::mergeOptions(
113 27
            $priceOptions,
114 27
            self::loadObFees($options->obFees, $options->obFeeRefs)
115 27
        );
116
117 27
        $priceOptions = self::mergeOptions(
118 27
            $priceOptions,
119 27
            self::loadPaxDiscount($options->paxDiscountCodes, $options->paxDiscountCodeRefs)
120 27
        );
121
122 27
        $priceOptions = self::mergeOptions(
123 27
            $priceOptions,
124 27
            self::loadPointOverrides(
125 27
                $options->pointOfSaleOverride,
126 27
                $options->pointOfTicketingOverride
127 27
            )
128 27
        );
129
130 27
        $priceOptions = self::mergeOptions(
131 27
            $priceOptions,
132 27
            self::loadPricingLogic($options->pricingLogic)
133 27
        );
134
135 27
        $priceOptions = self::mergeOptions(
136 27
            $priceOptions,
137 27
            self::loadTicketType($options->ticketType)
138 27
        );
139
140 27
        $priceOptions = self::mergeOptions(
141 27
            $priceOptions,
142 27
            self::loadTaxes($options->taxes)
143 27
        );
144
145 27
        $priceOptions = self::mergeOptions(
146 27
            $priceOptions,
147 27
            self::loadExemptTaxes($options->exemptTaxes)
148 27
        );
149
150 27
        $priceOptions = self::mergeOptions(
151 27
            $priceOptions,
152 27
            self::loadPastDate($options->pastDatePricing)
153 27
        );
154
155 27
        $priceOptions = self::mergeOptions(
156 27
            $priceOptions,
157 27
            self::loadReferences($options->references)
158 27
        );
159
160 27
        $priceOptions = self::mergeOptions(
161 27
            $priceOptions,
162 27
            self::makeOverrideOptions($options->overrideOptions, $priceOptions)
0 ignored issues
show
Documentation introduced by
$priceOptions is of type array<integer,object<Ama...Pricing\PricingOption>>, but the function expects a array<integer,object<Ama...13\PricingOptionGroup>>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
163 27
        );
164
165
        // All options processed, no options found:
166 27
        if (empty($priceOptions)) {
167 5
            $priceOptions[] = new PricingOptionGroup(PricingOptionKey::OPTION_NO_OPTION);
168 5
        }
169
170 27
        return $priceOptions;
171
    }
172
173
    /**
174
     * @param string[] $overrideOptions
175
     * @param PricingOptionGroup[] $priceOptions
176
     * @return PricingOptionGroup[]
177
     */
178 27 View Code Duplication
    protected static function makeOverrideOptions($overrideOptions, $priceOptions)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
179
    {
180 27
        $opt = [];
181
182 27
        foreach ($overrideOptions as $overrideOption) {
183 7
            if (!self::hasPricingGroup($overrideOption, $priceOptions)) {
184 7
                $opt[] = new PricingOptionGroup($overrideOption);
185 7
            }
186 27
        }
187
188 27
        return $opt;
189
    }
190
191
    /**
192
     * @param string|null $validatingCarrier
193
     * @return PricePnr13\PricingOptionGroup[]
194
     */
195 27 View Code Duplication
    protected static function makePricingOptionForValidatingCarrier($validatingCarrier)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
196
    {
197 27
        $opt = [];
198
199 27
        if ($validatingCarrier !== null) {
200 7
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_VALIDATING_CARRIER);
201
202 7
            $po->carrierInformation = new CarrierInformation($validatingCarrier);
203
204 7
            $opt[] = $po;
205 7
        }
206
207 27
        return $opt;
208
    }
209
210
    /**
211
     * @param string|null $currency
212
     * @return PricePnr13\PricingOptionGroup[]
213
     */
214 27 View Code Duplication
    protected static function makePricingOptionForCurrencyOverride($currency)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
215
    {
216 27
        $opt = [];
217
218 27
        if ($currency !== null) {
219 7
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_CURRENCY_OVERRIDE);
220
221 7
            $po->currency = new Currency($currency);
222
223 7
            $opt[] = $po;
224 7
        }
225
226 27
        return $opt;
227
    }
228
229
    /**
230
     * @param FareBasis[] $pricingsFareBasis
231
     * @return PricePnr13\PricingOptionGroup[]
232
     */
233 27
    protected static function makePricingOptionFareBasisOverride($pricingsFareBasis)
234
    {
235 27
        $opt = [];
236
237 27
        if ($pricingsFareBasis !== null) {
238 27
            foreach ($pricingsFareBasis as $pricingFareBasis) {
239 4
                $po = new PricingOptionGroup(PricingOptionKey::OPTION_FARE_BASIS_SIMPLE_OVERRIDE);
240
241
                //Support for legacy fareBasisPrimaryCode to be removed when breaking BC:
242 4
                $po->optionDetail = new OptionDetail(
243 4
                    $pricingFareBasis->fareBasisPrimaryCode.$pricingFareBasis->fareBasisCode
0 ignored issues
show
Deprecated Code introduced by
The property Amadeus\Client\RequestOp...::$fareBasisPrimaryCode has been deprecated with message: put the full fare basis in $this->fareBasisCode

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
244 4
                );
245
246
                //Support for legacy segmentReference to be removed when breaking BC:
247 4
                $po->paxSegTstReference = new PaxSegTstReference(
248 4
                    $pricingFareBasis->references,
249 4
                    $pricingFareBasis->segmentReference
0 ignored issues
show
Deprecated Code introduced by
The property Amadeus\Client\RequestOp...asis::$segmentReference has been deprecated with message: use $this->references instead

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
250 4
                );
251
252 4
                $opt[] = $po;
253 27
            }
254 27
        }
255
256 27
        return $opt;
257
    }
258
259
    /**
260
     * Load corporate negofare
261
     *
262
     * @param string|null $corporateNegoFare
263
     * @return PricingOptionGroup[]
264
     */
265 27 View Code Duplication
    protected static function loadCorpNegoFare($corporateNegoFare)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
266
    {
267 27
        $opt = [];
268
269 27
        if ($corporateNegoFare !== null) {
270 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_CORPORATE_NEGOTIATED_FARES);
271
272 1
            $po->optionDetail = new OptionDetail($corporateNegoFare);
273
274 1
            $opt[] = $po;
275 1
        }
276
277 27
        return $opt;
278
    }
279
280
    /**
281
     * Load corporate unifares
282
     *
283
     * @param string[] $corporateUniFares
284
     * @param AwardPricing|null $awardPricing
285
     * @return PricingOptionGroup[]
286
     */
287 27 View Code Duplication
    protected static function loadCorpUniFares($corporateUniFares, $awardPricing)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
288
    {
289 27
        $opt = [];
290
291 27
        if (!empty($corporateUniFares)) {
292 2
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_CORPORATE_UNIFARES);
293 2
            $po->optionDetail = new OptionDetail($corporateUniFares);
294 2
            $opt[] = $po;
295
296 2
            if (!empty($awardPricing)) {
297 1
                $opt[] = self::loadAwardPricing($awardPricing);
298 1
            }
299 2
        }
300
301 27
        return $opt;
302
    }
303
304
    /**
305
     * @param AwardPricing $awardPricing
306
     * @return PricingOptionGroup
307
     */
308 1
    protected static function loadAwardPricing($awardPricing)
309
    {
310 1
        $po = new PricingOptionGroup(PricingOptionKey::OPTION_AWARD_PRICING);
311
312 1
        $po->carrierInformation = new CarrierInformation($awardPricing->carrier);
313
314 1
        $po->frequentFlyerInformation = new FrequentFlyerInformation();
315 1
        $po->frequentFlyerInformation->frequentTravellerDetails[] = new FrequentTravellerDetails(
316 1
            $awardPricing->tierLevel
317 1
        );
318
319 1
        return $po;
320
    }
321
322
    /**
323
     * Load OB Fees
324
     *
325
     * @param ObFee[] $obFees
326
     * @param PaxSegRef[] $obFeeRefs
327
     * @return PricingOptionGroup[]
328
     */
329 27 View Code Duplication
    protected static function loadObFees($obFees, $obFeeRefs)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
330
    {
331 27
        $opt = [];
332
333 27
        if (!empty($obFees)) {
334 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_OB_FEES);
335
336 1
            $po->penDisInformation = new PenDisInformation(
337 1
                PenDisInformation::QUAL_OB_FEES,
338
                $obFees
339 1
            );
340
341 1
            if (!empty($obFeeRefs)) {
342 1
                $po->paxSegTstReference = new PaxSegTstReference($obFeeRefs);
343 1
            }
344
345 1
            $opt[] = $po;
346 1
        }
347
348 27
        return $opt;
349
    }
350
351
    /**
352
     * @param string[] $paxDiscount
353
     * @param PaxSegRef[] $paxDiscountCodeRefs
354
     * @return PricingOptionGroup[]
355
     */
356 27 View Code Duplication
    protected static function loadPaxDiscount($paxDiscount, $paxDiscountCodeRefs)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
357
    {
358 27
        $opt = [];
359
360 27
        if (!empty($paxDiscount)) {
361 4
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_PASSENGER_DISCOUNT_PTC);
362
363 4
            $po->penDisInformation = new PenDisInformation(
364 4
                PenDisInformation::QUAL_DISCOUNT,
365
                $paxDiscount
366 4
            );
367
368 4
            if (!empty($paxDiscountCodeRefs)) {
369 4
                $po->paxSegTstReference = new PaxSegTstReference($paxDiscountCodeRefs);
370 4
            }
371
372 4
            $opt[] = $po;
373 4
        }
374
375 27
        return $opt;
376
    }
377
378
    /**
379
     * @param string|null $posOverride
380
     * @param string|null $potOverride
381
     * @return PricingOptionGroup[]
382
     */
383 27
    protected static function loadPointOverrides($posOverride, $potOverride)
384
    {
385 27
        $opt = [];
386
387 27
        if (!empty($posOverride)) {
388 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_POINT_OF_SALE_OVERRIDE);
389
390 1
            $po->locationInformation = new LocationInformation(
391 1
                LocationInformation::TYPE_POINT_OF_SALE,
392
                $posOverride
393 1
            );
394
395 1
            $opt[] = $po;
396 1
        }
397
398 27
        if (!empty($potOverride)) {
399 1
            $po2 = new PricingOptionGroup(PricingOptionKey::OPTION_POINT_OF_TICKETING_OVERRIDE);
400
401 1
            $po2->locationInformation = new LocationInformation(
402 1
                LocationInformation::TYPE_POINT_OF_TICKETING,
403
                $potOverride
404 1
            );
405
406 1
            $opt[] = $po2;
407 1
        }
408
409 27
        return $opt;
410
    }
411
412
    /**
413
     * @param string|null $pricingLogic
414
     * @return PricingOptionGroup[]
415
     */
416 27 View Code Duplication
    protected static function loadPricingLogic($pricingLogic)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
417
    {
418 27
        $opt = [];
419
420 27
        if (!empty($pricingLogic)) {
421 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_PRICING_LOGIC);
422 1
            $po->optionDetail = new OptionDetail($pricingLogic);
423 1
            $opt[] = $po;
424 1
        }
425
426 27
        return $opt;
427
    }
428
429
    /**
430
     * @param string|null $ticketType
431
     * @return PricingOptionGroup[]
432
     */
433 27 View Code Duplication
    protected static function loadTicketType($ticketType)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
434
    {
435 27
        $opt = [];
436
437 27
        if (!empty($ticketType)) {
438 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_TICKET_TYPE);
439
440 1
            $po->optionDetail = new OptionDetail($ticketType);
441
442 1
            $opt[] = $po;
443 1
        }
444
445 27
        return $opt;
446
    }
447
448
    /**
449
     * @param Tax[] $taxes
450
     * @return PricingOptionGroup[]
451
     */
452 27
    protected static function loadTaxes($taxes)
453
    {
454 27
        $opt = [];
455
456 27
        if (!empty($taxes)) {
457 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_ADD_TAX);
458
459 1
            foreach ($taxes as $tax) {
460 1
                $qualifier = (!empty($tax->amount)) ? TaxData::QUALIFIER_AMOUNT : TaxData::QUALIFIER_PERCENTAGE;
461 1
                $rate = (!empty($tax->amount)) ? $tax->amount : $tax->percentage;
462
463 1
                $po->taxInformation[] = new TaxInformation(
464 1
                    $tax->countryCode,
465 1
                    $tax->taxNature,
466 1
                    $qualifier,
467
                    $rate
468 1
                );
469 1
            }
470 1
            $opt[] = $po;
471 1
        }
472
473 27
        return $opt;
474
    }
475
476
    /**
477
     * @param ExemptTax[] $exemptTaxes
478
     * @return PricingOptionGroup[]
479
     */
480 27
    protected static function loadExemptTaxes($exemptTaxes)
481
    {
482 27
        $opt = [];
483
484 27
        if (!empty($exemptTaxes)) {
485 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_EXEMPT_FROM_TAX);
486
487 1
            foreach ($exemptTaxes as $tax) {
488 1
                $po->taxInformation[] = new TaxInformation(
489 1
                    $tax->countryCode,
490 1
                    $tax->taxNature
491 1
                );
492 1
            }
493
494 1
            $opt[] = $po;
495 1
        }
496
497 27
        return $opt;
498
    }
499
500
    /**
501
     * @param \DateTime|null $pastDate
502
     * @return PricingOptionGroup[]
503
     */
504 27 View Code Duplication
    protected static function loadPastDate($pastDate)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
505
    {
506 27
        $opt = [];
507
508 27
        if ($pastDate instanceof \DateTime) {
509 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_PAST_DATE_PRICING);
510
511 1
            $po->dateInformation = new DateInformation(
512 1
                DateInformation::OPT_DATE_OVERRIDE,
513
                $pastDate
514 1
            );
515
516 1
            $opt[] = $po;
517 1
        }
518
519 27
        return $opt;
520
    }
521
522
    /**
523
     * @param PaxSegRef[] $references
524
     * @return PricingOptionGroup[]
525
     */
526 27 View Code Duplication
    protected static function loadReferences($references)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
527
    {
528 27
        $opt = [];
529
530 27
        if (!empty($references)) {
531 1
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_PAX_SEGMENT_TST_SELECTION);
532
533 1
            $po->paxSegTstReference = new PaxSegTstReference($references);
534
535 1
            $opt[] = $po;
536 1
        }
537
538 27
        return $opt;
539
    }
540
}
541