LocationDetails   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 1
dl 0
loc 72
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 20 7
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
use Amadeus\Client\RequestOptions\Fare\MPLocation;
26
27
/**
28
 * LocationDetails
29
 *
30
 * @package Amadeus\Client\Struct\Fare\MasterPricer
31
 * @author Dieter Devlieghere <[email protected]>
32
 */
33
class LocationDetails
34
{
35
    /**
36
     * Specifies a reference given to a number of flight segment in the querying system
37
     *
38
     * @var int
39
     */
40
    public $distance;
41
    /**
42
     * Indicates the reference of the number of flight segment
43
     * K  Kilometers
44
     * P  Passenger/traveller reference number
45
     * S  PNR segment reference number
46
     *
47
     * @var string
48
     */
49
    public $distanceUnit;
50
    /**
51
     * Use ATA/IATA defined 3 letter city code
52
     *
53
     * @var string
54
     */
55
    public $locationId;
56
    /**
57
     *
58
     * A  Airport
59
     * C  City
60
     * D  Consider Destination (off point) of the PNR requested segment
61
     * O  Consider Origin (board point) of the PNR requested segment
62
     *
63
     * @var string
64
     */
65
    public $airportCityQualifier;
66
    /**
67
     * Latitude in degrees
68
     *
69
     * @var string
70
     */
71
    public $latitude;
72
    /**
73
     * Longitude in degrees
74
     *
75
     * @var string
76
     */
77
    public $longitude;
78
79
    /**
80
     * LocationDetails constructor.
81
     *
82
     * @param MPLocation $location
83
     */
84
    public function __construct(MPLocation $location)
85
    {
86
        if (!empty($location->airport)) {
87
            $this->locationId = $location->airport;
88
            $this->airportCityQualifier = "A";
89
        } elseif (!empty($location->city)) {
90
            $this->locationId = $location->city;
91
            $this->airportCityQualifier = "C";
92
        }
93
94
        if (!empty($location->longitude) && !empty($location->latitude)) {
95
            $this->longitude = $location->longitude;
96
            $this->latitude = $location->latitude;
97
        }
98
99
        if (!empty($location->radiusDistance) && !empty($location->radiusUnit)) {
100
            $this->distance = $location->radiusDistance;
101
            $this->distanceUnit = $location->radiusUnit;
102
        }
103
    }
104
}
105