LocationVO::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 4
1
<?php namespace OutlookRestClient\Facade\Requests;
2
/**
3
 * Copyright 2017 OpenStack Foundation
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 * http://www.apache.org/licenses/LICENSE-2.0
8
 * Unless required by applicable law or agreed to in writing, software
9
 * distributed under the License is distributed on an "AS IS" BASIS,
10
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
 * See the License for the specific language governing permissions and
12
 * limitations under the License.
13
 **/
14
15
/**
16
 * Class LocationVO
17
 * @package OutlookRestClient\Facade\Requests
18
 */
19
final class LocationVO implements IValueObject
20
{
21
    /**
22
     * @var AddressVO
23
     */
24
    private $address;
25
26
    /**
27
     * @var string
28
     */
29
    private $location_name;
30
    /**
31
     * @var string
32
     */
33
    private $location_lat;
34
35
    /**
36
     * @var string
37
     */
38
    private $location_lng;
39
40
    /**
41
     * LocationVO constructor.
42
     * @param string $location_name
43
     * @param AddressVO $address
44
     * @param string $location_lat
45
     * @param string $location_lng
46
     */
47
    public function __construct($location_name, AddressVO $address, $location_lat = null, $location_lng = null)
48
    {
49
        $this->location_name = $location_name;
50
        $this->address       = $address;
51
        $this->location_lat  = $location_lat;
52
        $this->location_lng  = $location_lng;
53
    }
54
55
    /**
56
     * @return AddressVO
57
     */
58
    public function getAddress()
59
    {
60
        return $this->address;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getLocationName()
67
    {
68
        return $this->location_name;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getLocationLat()
75
    {
76
        return $this->location_lat;
77
    }
78
79
    /**
80
     * @return string
81
     */
82
    public function getLocationLng()
83
    {
84
        return $this->location_lng;
85
    }
86
87
    /**
88
     * @return array
89
     */
90
    public function toArray()
91
    {
92
        return [
93
94
            "DisplayName"  => $this->location_name,
95
            'Address'      => $this->address->toArray(),
96
            "Coordinates"          => [
97
                "Latitude"  => $this->location_lat,
98
                "Longitude" => $this->location_lng,
99
            ],
100
            "LocationEmailAddress" => null
101
        ];
102
    }
103
}