You are here

public function Random::doReverse in Geocoder 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/Geocoder/Provider/Random.php \Drupal\geocoder\Plugin\Geocoder\Provider\Random::doReverse()

Performs the reverse geocode.

Parameters

float $latitude: The latitude.

float $longitude: The longitude.

Return value

\Geocoder\Model\AddressCollection|null The AddressCollection, NULL otherwise.

Overrides ProviderBase::doReverse

File

src/Plugin/Geocoder/Provider/Random.php, line 43

Class

Random
Class Random.

Namespace

Drupal\geocoder\Plugin\Geocoder\Provider

Code

public function doReverse($latitude, $longitude) {
  $result = $this
    ->getRandomResult();
  $result['latitude'] = $latitude;
  $result['longitude'] = $longitude;
  return $this
    ->getAddressFactory()
    ->createFromArray([
    $result,
  ]);
}