public function geocode($address)
{
if (null === $this->apiKey) {
throw new InvalidCredentials('No API Key provided.');
}
// This API doesn't handle IPs
if (filter_var($address, FILTER_VALIDATE_IP)) {
throw new UnsupportedOperation('The TomTom provider does not support IP addresses, only street addresses.');
}
$query = sprintf(self::GEOCODE_ENDPOINT_URL, $this->apiKey, rawurlencode($address), $this->getLimit());
return $this->executeQuery($query);
}
/** * @expectedException \Geocoder\Exception\UnsupportedOperation * @expectedExceptionMessage The TomTom provider does not support IP addresses, only street addresses. */ public function testGeocodeWithIPv6() { $provider = new TomTom($this->getAdapter(), 'api_key'); $provider->geocode('::ffff:74.200.247.59'); }