Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
Coordinates | |
100.00% |
8 / 8 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getLatitude | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLongitude | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\IPInfo\Info; |
4 | |
5 | use JsonSerializable; |
6 | |
7 | class Coordinates implements JsonSerializable { |
8 | private float $latitude; |
9 | |
10 | private float $longitude; |
11 | |
12 | public function __construct( |
13 | float $latitude, |
14 | float $longitude |
15 | ) { |
16 | $this->latitude = $latitude; |
17 | $this->longitude = $longitude; |
18 | } |
19 | |
20 | public function getLatitude(): float { |
21 | return $this->latitude; |
22 | } |
23 | |
24 | public function getLongitude(): float { |
25 | return $this->longitude; |
26 | } |
27 | |
28 | public function jsonSerialize(): array { |
29 | return [ |
30 | 'longitude' => $this->getLongitude(), |
31 | 'latitude' => $this->getLatitude(), |
32 | ]; |
33 | } |
34 | } |