Geocoder\Provider\IpInfoDb::__construct PHP Method

__construct() public method

public __construct ( Http\Client\HttpClient $client, string $apiKey, string $precision = 'city' )
$client Http\Client\HttpClient An HTTP adapter.
$apiKey string An API key.
$precision string The endpoint precision. Either "city" or "country" (faster)
    public function __construct(HttpClient $client, $apiKey, $precision = 'city')
    {
        parent::__construct($client);
        $this->apiKey = $apiKey;
        switch ($precision) {
            case 'city':
                $this->endpointUrl = self::CITY_PRECISION_ENDPOINT_URL;
                break;
            case 'country':
                $this->endpointUrl = self::COUNTRY_PRECISION_ENDPOINT_URL;
                break;
            default:
                throw new InvalidArgument(sprintf('Invalid precision value "%s" (allowed values: "city", "country").', $precision));
        }
    }