Total Complexity | 3 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | class Location |
||
9 | { |
||
10 | /** |
||
11 | * @var string The city name. |
||
12 | */ |
||
13 | public $city; |
||
14 | |||
15 | /** |
||
16 | * @var string The countryCode code. |
||
17 | */ |
||
18 | public $countryCode; |
||
19 | |||
20 | /** |
||
21 | * @var float|null The longitude coordinate. |
||
22 | */ |
||
23 | public $lon; |
||
24 | |||
25 | /** |
||
26 | * @var float|null The latitude coordinate. |
||
27 | */ |
||
28 | public $lat; |
||
29 | |||
30 | /** |
||
31 | * Location constructor. |
||
32 | * @param string $city The city name. |
||
33 | * @param string $countryCode The country code. |
||
34 | * @param float|null $lat The longitude coordinate. |
||
35 | * @param float|null $lon The latitude coordinate. |
||
36 | */ |
||
37 | public function __construct(string $city, string $countryCode, $lat = null, $lon = null) |
||
38 | { |
||
39 | $this->city = $city; |
||
40 | $this->countryCode = $countryCode; |
||
41 | $this->lat = $lat; |
||
42 | $this->lon = $lon; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return array |
||
47 | */ |
||
48 | public function getCoordinates(): array |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Encoding to json. |
||
55 | * @return false|string |
||
56 | */ |
||
57 | public function toJson() |
||
69 |