Update docblocks

This commit is contained in:
brabli
2024-08-05 14:50:26 +01:00
parent 8b662ebfa3
commit 10d1d3c318
3 changed files with 17 additions and 8 deletions

View File

@@ -10,6 +10,9 @@ use Pcm\GeocodeBundle\Model\GeoCoordinates;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* Find the geo-coordinates of a postcode
*/
final class Geocoder
{
private const string API_URL = "https://nominatim.openstreetmap.org/search";
@@ -17,12 +20,16 @@ final class Geocoder
public function __construct(private HttpClientInterface $client) {}
/**
* Convert a postcode into latitude and longitude. Returns null if conversion failed.
* Find and return the geo-coordinates of a postcode
*
* @param string $postcode
* @return null|GeoCoordinates
*
* @return GeoCoordinates
*
* @throws NoResultsFoundException when no results were found for the provided postcode
* @throws ApiErrorException when the API response contains an error
*/
public function geocodePostcode(string $postcode): ?GeoCoordinates
public function geocodePostcode(string $postcode): GeoCoordinates
{
$client = $this->createClient();
$response = $this->makeApiRequest($client, $postcode);