| @@ 10-58 (lines=49) @@ | ||
| 7 | use Marek\OpenWeatherMap\API\Exception\InvalidArgumentException; |
|
| 8 | use Marek\OpenWeatherMap\API\Value\Parameter\GetParameterInterface; |
|
| 9 | ||
| 10 | class Latitude implements GetParameterInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @var float |
|
| 14 | */ |
|
| 15 | protected $latitude; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * Latitude constructor. |
|
| 19 | * |
|
| 20 | * |
|
| 21 | * @param float $latitude |
|
| 22 | * |
|
| 23 | * @throws \Marek\OpenWeatherMap\API\Exception\InvalidArgumentException |
|
| 24 | */ |
|
| 25 | public function __construct(float $latitude) |
|
| 26 | { |
|
| 27 | $this->validate($latitude); |
|
| 28 | $this->latitude = $latitude; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @return float |
|
| 33 | */ |
|
| 34 | public function getLatitude(): float |
|
| 35 | { |
|
| 36 | return $this->latitude; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function getGetParameterValue(): string |
|
| 43 | { |
|
| 44 | return (string) $this->latitude; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * {@inheritdoc} |
|
| 49 | */ |
|
| 50 | public function getGetParameterName(): string |
|
| 51 | { |
|
| 52 | return 'lat'; |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @param float $latitude |
|
| 57 | * |
|
| 58 | * @throws \Marek\OpenWeatherMap\API\Exception\InvalidArgumentException |
|
| 59 | */ |
|
| 60 | protected function validate(float $latitude): void |
|
| 61 | { |
|
| @@ 10-58 (lines=49) @@ | ||
| 7 | use Marek\OpenWeatherMap\API\Exception\InvalidArgumentException; |
|
| 8 | use Marek\OpenWeatherMap\API\Value\Parameter\GetParameterInterface; |
|
| 9 | ||
| 10 | class Longitude implements GetParameterInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @var float |
|
| 14 | */ |
|
| 15 | protected $longitude; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * Longitude constructor. |
|
| 19 | * |
|
| 20 | * |
|
| 21 | * @param float $longitude |
|
| 22 | * |
|
| 23 | * @throws \Marek\OpenWeatherMap\API\Exception\InvalidArgumentException |
|
| 24 | */ |
|
| 25 | public function __construct(float $longitude) |
|
| 26 | { |
|
| 27 | $this->validate($longitude); |
|
| 28 | $this->longitude = $longitude; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @return float |
|
| 33 | */ |
|
| 34 | public function getLongitude(): float |
|
| 35 | { |
|
| 36 | return $this->longitude; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function getGetParameterValue(): string |
|
| 43 | { |
|
| 44 | return (string) $this->longitude; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * {@inheritdoc} |
|
| 49 | */ |
|
| 50 | public function getGetParameterName(): string |
|
| 51 | { |
|
| 52 | return 'lon'; |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @param float $longitude |
|
| 57 | * |
|
| 58 | * @throws \Marek\OpenWeatherMap\API\Exception\InvalidArgumentException |
|
| 59 | */ |
|
| 60 | protected function validate(float $longitude): void |
|
| 61 | { |
|