| @@ 21-34 (lines=14) @@ | ||
| 18 | * @param float $value |
|
| 19 | * @param string $message |
|
| 20 | */ |
|
| 21 | public static function latitude($value, $message = '') |
|
| 22 | { |
|
| 23 | if (!is_float($value)) { |
|
| 24 | throw new \InvalidArgumentException( |
|
| 25 | sprintf($message ?: 'Expected a double. Got: %s', self::typeToString($value)) |
|
| 26 | ); |
|
| 27 | } |
|
| 28 | ||
| 29 | if ($value < -90 || $value > 90) { |
|
| 30 | throw new \InvalidArgumentException( |
|
| 31 | sprintf($message ?: 'Latitude should be between -90 and 90. Got: %s', $value) |
|
| 32 | ); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @param float $value |
|
| @@ 40-53 (lines=14) @@ | ||
| 37 | * @param float $value |
|
| 38 | * @param string $message |
|
| 39 | */ |
|
| 40 | public static function longitude($value, $message = '') |
|
| 41 | { |
|
| 42 | if (!is_float($value)) { |
|
| 43 | throw new \InvalidArgumentException( |
|
| 44 | sprintf($message ?: 'Expected a doable. Got: %s', self::typeToString($value)) |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | if ($value < -180 || $value > 180) { |
|
| 49 | throw new \InvalidArgumentException( |
|
| 50 | sprintf($message ?: 'Latitude should be between -90 and 90. Got: %s', $value) |
|
| 51 | ); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @param mixed $value |
|