Geocoder\Provider\Geonames::reverse PHP Méthode

reverse() public méthode

{@inheritDoc}
public reverse ( $latitude, $longitude )
    public function reverse($latitude, $longitude)
    {
        if (null === $this->username) {
            throw new InvalidCredentials('No username provided.');
        }
        $query = sprintf(self::REVERSE_ENDPOINT_URL, $latitude, $longitude, $this->getLimit(), $this->username);
        return $this->executeQuery($query);
    }

Usage Example

Exemple #1
0
    /**
     * @expectedException \Geocoder\Exception\NoResult
     * @expectedExceptionMessage Could not execute query "http://api.geonames.org/findNearbyPlaceNameJSON?lat=-80.000000&lng=-170.000000&style=full&maxRows=5&username=username".
     */
    public function testReverseWithBadCoordinates()
    {
        $badCoordinateResponse = <<<JSON
{
    "geonames": [ ]
}
JSON;
        $provider = new Geonames($this->getMockAdapterReturns($badCoordinateResponse), 'username');
        $provider->reverse(-80.0, -170.0);
    }