Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
Location | |
100.00% |
8 / 8 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLabel | |
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 Location implements JsonSerializable { |
8 | private int $id; |
9 | |
10 | private string $label; |
11 | |
12 | public function __construct( |
13 | int $id, |
14 | string $label |
15 | ) { |
16 | $this->id = $id; |
17 | $this->label = $label; |
18 | } |
19 | |
20 | public function getId(): int { |
21 | return $this->id; |
22 | } |
23 | |
24 | public function getLabel(): string { |
25 | return $this->label; |
26 | } |
27 | |
28 | public function jsonSerialize(): array { |
29 | return [ |
30 | 'id' => $this->getId(), |
31 | 'label' => $this->getLabel(), |
32 | ]; |
33 | } |
34 | } |