/** * {@inheritdoc} */ public function reverse($latitude, $longitude) { $key = 'geocoder_' . sha1($this->locale . $latitude . $longitude); if (false !== ($data = $this->cache->fetch($key))) { return unserialize($data); } $data = $this->provider->reverse($latitude, $longitude); $this->cache->save($key, serialize($data), $this->lifetime); return $data; }
/** * Results usually from most accurate to least accurate result (street_address, ..., country) * * @param float $lat * @param float $lng * @param array $params * @return \Geocoder\Model\AddressCollection Result */ public function reverse($lat, $lng, array $params = []) { $this->_buildGeocoder(); $result = $this->geocoder->reverse($lat, $lng); if (!$this->_config['allowInconclusive'] && !$this->isConclusive($result)) { throw new InconclusiveException(sprintf('Inconclusive result (total of %s)', $result->count())); } if ($this->_config['minAccuracy'] && !$this->containsAccurateEnough($result)) { throw new NotAccurateEnoughException('Result is not accurate enough'); } return $result; }