PricingFareBase   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 43
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 22 4
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\PricePnr12;
24
25
use Amadeus\Client\RequestOptions\Fare\PricePnr\FareBasis;
26
27
/**
28
 * PricingFareBase
29
 *
30
 * @package Amadeus\Client\Struct\Fare\PricePnr12
31
 * @author dieter <[email protected]>
32
 */
33
class PricingFareBase
34
{
35
    /**
36
     * @var FareBasisOptions
37
     */
38
    public $fareBasisOptions;
39
    /**
40
     * @var FareBasisSegReference[]
41
     */
42
    public $fareBasisSegReference = [];
43
    /**
44
     * @var array
45
     */
46
    public $fareBasisDates = [];
47
48
    /**
49
     * PricingFareBase constructor.
50
     *
51
     * @param FareBasis $options
52
     */
53
    public function __construct(FareBasis $options)
54
    {
55
        if (empty($options->fareBasisPrimaryCode)) {
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...
56
            //Support for legacy input format - to be removed when breaking BC
57
            $fareBasisPrimaryCode = substr($options->fareBasisCode, 0, 3);
58
            $fareBasisCode = substr($options->fareBasisCode, 3);
59
        } else {
60
            $fareBasisPrimaryCode = $options->fareBasisPrimaryCode;
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...
61
            $fareBasisCode = $options->fareBasisCode;
62
        }
63
64
        $this->fareBasisOptions = new FareBasisOptions($fareBasisPrimaryCode, $fareBasisCode);
65
66
        //Support legacy segment reference format - to be removed when breaking BC
67
        foreach ($options->segmentReference as $segNum => $segQual) {
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...
68
            $this->fareBasisSegReference[] = new FareBasisSegReference($segNum, $segQual);
69
        }
70
71
        foreach ($options->references as $reference) {
72
            $this->fareBasisSegReference[] = new FareBasisSegReference($reference->reference, $reference->type);
73
        }
74
    }
75
}
76