| @@ 32-43 (lines=12) @@ | ||
| 29 | $this->longitude = (float) $longitude; |
|
| 30 | } |
|
| 31 | ||
| 32 | private function assertNumeric($type, $coordinate) |
|
| 33 | { |
|
| 34 | if (!is_float($coordinate) && !is_int($coordinate) && !is_double($coordinate)) { |
|
| 35 | throw new InvalidCoordinateException( |
|
| 36 | sprintf( |
|
| 37 | 'Invalid %s: expected float, int or double, got %s', |
|
| 38 | $type, |
|
| 39 | gettype($coordinate) |
|
| 40 | ) |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @return float |
|
| @@ 17-28 (lines=12) @@ | ||
| 14 | /** |
|
| 15 | * @param int|float $radius |
|
| 16 | */ |
|
| 17 | public function __construct($radius) |
|
| 18 | { |
|
| 19 | if (!is_int($radius) && !is_float($radius)) { |
|
| 20 | throw new InvalidRadiusException( |
|
| 21 | sprintf( |
|
| 22 | 'Invalid radius: expected float or int, got %s', |
|
| 23 | gettype($radius) |
|
| 24 | ) |
|
| 25 | ); |
|
| 26 | } |
|
| 27 | $this->radius = (float) $radius; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return float |
|