You are here

public function Random::doReverse in Geocoder 8.3

Same name and namespace in other branches
  1. 8.2 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 49

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 new AddressCollection([
    $this
      ->getAddressFactory()
      ->createFromArray($result),
  ]);
}