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