Compare commits

..

No commits in common. 'master' and 'v0.0.6' have entirely different histories.

@ -16,12 +16,9 @@ interface GeocodingServiceContract
public function getCoordinatesForAddress(string $address): GeocodingResponseData; public function getCoordinatesForAddress(string $address): GeocodingResponseData;
/** /**
* Retrieves the address for the given coordinates. * @param float $latitude
* * @param float $longitude
* @param float $latitude The latitude of the coordinates. * @return array
* @param float $longitude The longitude of the coordinates.
*
* @return GeocodingResponseData The address information for the given coordinates.
*/ */
public function getAddressForCoordinates(float $latitude, float $longitude): GeocodingResponseData; public function getAddressForCoordinates(float $latitude, float $longitude): array;
} }

@ -37,16 +37,8 @@ class GeocodingService implements GeocodingServiceContract
*/ */
public function getCoordinatesForAddress(string $address): GeocodingResponseData public function getCoordinatesForAddress(string $address): GeocodingResponseData
{ {
$response = $this->geocoder->getCoordinatesForAddress($address);
$viewport = array_key_exists('viewport', $response)
? get_object_vars($response['viewport'])
: [];
$response['viewport'] = $viewport;
return GeocodingResponseData::from( return GeocodingResponseData::from(
$response $this->geocoder->getCoordinatesForAddress($address)
); );
} }
@ -56,20 +48,10 @@ class GeocodingService implements GeocodingServiceContract
* @param float $latitude The latitude of the coordinates. * @param float $latitude The latitude of the coordinates.
* @param float $longitude The longitude of the coordinates. * @param float $longitude The longitude of the coordinates.
* *
* @return GeocodingResponseData The address information for the given coordinates. * @return array The address information for the given coordinates.
*/ */
public function getAddressForCoordinates(float $latitude, float $longitude): GeocodingResponseData public function getAddressForCoordinates(float $latitude, float $longitude): array
{ {
$response = $this->geocoder->getAddressForCoordinates($latitude, $longitude); return $this->geocoder->getAddressForCoordinates($latitude, $longitude);
$viewport = array_key_exists('viewport', $response)
? get_object_vars($response['viewport'])
: [];
$response['viewport'] = $viewport;
return GeocodingResponseData::from(
$response
);
} }
} }
Loading…
Cancel
Save