Total Complexity | 7 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class Point implements PointInterface |
||
13 | { |
||
14 | use HasDataTrait; |
||
15 | use HasSpaceTrait; |
||
16 | |||
17 | private float $lat; |
||
18 | |||
19 | private float $long; |
||
20 | |||
21 | public function __construct(float $lat, float $long) |
||
22 | { |
||
23 | $this->validateCoordinates($lat, $long); |
||
24 | $this->setSpace(Space::singleton()); |
||
25 | $this->lat = $lat; |
||
26 | $this->long = $long; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @return array{0: float, 1: float} |
||
31 | */ |
||
32 | public function getCoordinates(): array |
||
33 | { |
||
34 | return [$this->lat, $this->long]; |
||
35 | } |
||
36 | |||
37 | private function validateCoordinates(float $lat, float $long): void |
||
42 | ); |
||
43 | } |
||
44 | } |
||
46 |