Code Duplication    Length = 23-23 lines in 2 locations

src/Amadeus/Client/Struct/Ticket/RepricePnrWithBookingClass.php 1 location

@@ 365-387 (lines=23) @@
362
     * @param Tax[] $taxes
363
     * @return PricingOption[]
364
     */
365
    protected function loadTaxes($taxes)
366
    {
367
        $opt = [];
368
369
        if (!empty($taxes)) {
370
            $po = new PricingOption(PricingOptionKey::OPTION_ADD_TAX);
371
372
            foreach ($taxes as $tax) {
373
                $qualifier = (!empty($tax->amount)) ? TaxData::QUALIFIER_AMOUNT : TaxData::QUALIFIER_PERCENTAGE;
374
                $rate = (!empty($tax->amount)) ? $tax->amount : $tax->percentage;
375
376
                $po->taxInformation[] = new TaxInformation(
377
                    $tax->countryCode,
378
                    $tax->taxNature,
379
                    $qualifier,
380
                    $rate
381
                );
382
            }
383
            $opt[] = $po;
384
        }
385
386
        return $opt;
387
    }
388
389
    /**
390
     * @param ExemptTax[] $exemptTaxes

src/Amadeus/Client/Struct/Fare/PricePNRWithBookingClass13.php 1 location

@@ 530-552 (lines=23) @@
527
     * @param Tax[] $taxes
528
     * @return PricingOptionGroup[]
529
     */
530
    protected static function loadTaxes($taxes)
531
    {
532
        $opt = [];
533
534
        if (!empty($taxes)) {
535
            $po = new PricingOptionGroup(PricingOptionKey::OPTION_ADD_TAX);
536
537
            foreach ($taxes as $tax) {
538
                $qualifier = (!empty($tax->amount)) ? TaxData::QUALIFIER_AMOUNT : TaxData::QUALIFIER_PERCENTAGE;
539
                $rate = (!empty($tax->amount)) ? $tax->amount : $tax->percentage;
540
541
                $po->taxInformation[] = new TaxInformation(
542
                    $tax->countryCode,
543
                    $tax->taxNature,
544
                    $qualifier,
545
                    $rate
546
                );
547
            }
548
            $opt[] = $po;
549
        }
550
551
        return $opt;
552
    }
553
554
    /**
555
     * @param ExemptTax[] $exemptTaxes