Elastica\Query\AbstractGeoDistance::_getLocationData PHP Method

_getLocationData() protected method

protected _getLocationData ( ) : array | string
return array | string
    protected function _getLocationData()
    {
        if ($this->_locationType === self::LOCATION_TYPE_LATLON) {
            // Latitude/longitude
            $location = [];
            if (isset($this->_latitude)) {
                // Latitude
                $location['lat'] = $this->_latitude;
            } else {
                throw new InvalidException('Latitude has to be set');
            }
            if (isset($this->_longitude)) {
                // Geohash
                $location['lon'] = $this->_longitude;
            } else {
                throw new InvalidException('Longitude has to be set');
            }
        } elseif ($this->_locationType === self::LOCATION_TYPE_GEOHASH) {
            // Geohash
            $location = $this->_geohash;
        } else {
            // Invalid location type
            throw new InvalidException('Invalid location type');
        }
        return $location;
    }