Conditions | 5 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
57 | private function setLongitudeIsValid($longitude): void |
||
58 | { |
||
59 | $isValid = true; |
||
60 | |||
61 | if (!is_numeric($longitude)) { |
||
62 | $isValid = false; |
||
63 | } |
||
64 | |||
65 | $longitude = (float)$longitude; |
||
66 | |||
67 | if (!$isValid || $longitude < -180 || $longitude > 180) { |
||
68 | throw new InvalidArgumentException('Invalid longitude. It must be a number between -90 and 90'); |
||
69 | } |
||
70 | |||
71 | $this->longitude = $longitude; |
||
72 | } |
||
74 |