Lines Matching refs:location
22 * Decides if this query uses latitude/longitude or geohash for the location.
60 * @param array|string $location Location as array or geohash: array('lat' => 48.86, 'lon' => 2.35) OR 'drm3btev3e86'
64 public function __construct(string $key, $location)
67 $this->setLocation($location);
81 * @param array|string $location
87 public function setLocation($location): self
90 if (\is_array($location)) { // Latitude/Longitude
92 if (isset($location['lat'])) {
93 $this->setLatitude($location['lat']);
95 throw new InvalidException('$location[\'lat\'] has to be set');
99 if (isset($location['lon'])) {
100 $this->setLongitude($location['lon']);
102 throw new InvalidException('$location[\'lon\'] has to be set');
104 } elseif (\is_string($location)) { // Geohash
105 $this->setGeohash($location);
106 } else { // Invalid location
107 throw new InvalidException('$location has to be an array (latitude/longitude) or a string (geohash)');
164 $location = [];
167 $location['lat'] = $this->_latitude;
173 $location['lon'] = $this->_longitude;
178 $location = $this->_geohash;
179 } else { // Invalid location type
180 throw new InvalidException('Invalid location type');
183 return $location;