district09/php_package_dg-geopunt-geolocation

View on GitHub
src/GeolocationFactory.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

namespace DigipolisGent\Geopunt\Geolocation;

use DigipolisGent\API\Client\ClientInterface;
use DigipolisGent\Geopunt\Geolocation\Handler\LocationHandler;
use DigipolisGent\Geopunt\Geolocation\Handler\SuggestionHandler;

/**
 * Factory to get the geolocation service.
 */
final class GeolocationFactory
{
    /**
     * @param \DigipolisGent\API\Client\ClientInterface $client
     *
     * @return \DigipolisGent\Geopunt\Geolocation\GeolocationInterface
     */
    public static function create(ClientInterface $client): GeolocationInterface
    {
        $client->addHandler(new SuggestionHandler());
        $client->addHandler(new LocationHandler());

        return new Geolocation($client);
    }
}