1 | <?php |
||
10 | class CardinalDirectionDistances |
||
11 | { |
||
12 | /** @var float */ |
||
13 | private $north; |
||
14 | |||
15 | /** @var float */ |
||
16 | private $east; |
||
17 | |||
18 | /** @var float */ |
||
19 | private $south; |
||
20 | |||
21 | /** @var float */ |
||
22 | private $west; |
||
23 | |||
24 | private function __construct(float $north, float $east, float $south, float $west) |
||
31 | |||
32 | /** |
||
33 | * @psalm-pure |
||
34 | * @psalm-mutation-free |
||
35 | */ |
||
36 | public static function create(): self |
||
40 | |||
41 | /** @psalm-mutation-free */ |
||
42 | public function setNorth(float $north): self |
||
48 | |||
49 | /** @psalm-mutation-free */ |
||
50 | public function setEast(float $east): self |
||
56 | |||
57 | /** @psalm-mutation-free */ |
||
58 | public function setSouth(float $south): self |
||
64 | |||
65 | /** @psalm-mutation-free */ |
||
66 | public function setWest(float $west): self |
||
72 | |||
73 | /** @psalm-mutation-free */ |
||
74 | public function getNorth(): float |
||
78 | |||
79 | /** @psalm-mutation-free */ |
||
80 | public function getEast(): float |
||
84 | |||
85 | /** @psalm-mutation-free */ |
||
86 | public function getSouth(): float |
||
90 | |||
91 | /** @psalm-mutation-free */ |
||
92 | public function getWest(): float |
||
96 | |||
97 | /** |
||
98 | * @psalm-pure |
||
99 | * @psalm-mutation-free |
||
100 | * |
||
101 | * @throws InvalidDistanceException |
||
102 | */ |
||
103 | private function validatePositive(float $value): void |
||
109 | } |
||
110 |