private function Random::getRandomResult in Geocoder 7.2
Same name and namespace in other branches
- 8.3 src/Plugin/Geocoder/Provider/Random.php \Drupal\geocoder\Plugin\Geocoder\Provider\Random::getRandomResult()
- 8.2 src/Plugin/Geocoder/Provider/Random.php \Drupal\geocoder\Plugin\Geocoder\Provider\Random::getRandomResult()
Generate a fake random address array.
Return value
array
2 calls to Random::getRandomResult()
- Random::geocode in src/Plugin/ Geocoder/ Provider/ Random.php 
- Geocode data
- Random::reverse in src/Plugin/ Geocoder/ Provider/ Random.php 
- Reverse geocode latitude and longitude.
File
- src/Plugin/ Geocoder/ Provider/ Random.php, line 107 
- The TomTom plugin.
Class
- Random
- Class Random.
Namespace
Drupal\geocoder\Plugin\Geocoder\ProviderCode
private function getRandomResult() {
  $country = $this
    ->getRandomCountryInfo();
  $streetTypes = array(
    'street',
    'avenue',
    'square',
    'road',
    'way',
    'drive',
    'lane',
    'place',
    'hill',
    'gardens',
    'park',
  );
  return array(
    'latitude' => mt_rand(0, 90) + mt_rand() / mt_getrandmax(),
    'longitude' => mt_rand(-180, 180) + mt_rand() / mt_getrandmax(),
    'streetName' => $this
      ->getRandomCountryInfo('name') . ' ' . $streetTypes[mt_rand(0, count($streetTypes) - 1)],
    'streetNumber' => mt_rand(1, 1000),
    'postalCode' => mt_rand(1, 1000),
    'locality' => sha1(mt_rand() / mt_getrandmax()),
    'country' => $country['name'],
    'countryCode' => $country['code'],
  );
}