Class Socialveo\Core\helpers\LocationHelper

InheritanceSocialveo\Core\helpers\LocationHelper

Class LocationHelper

Public Methods

Hide inherited methods

MethodDescriptionDefined By
autocomplete() Google map autocomplete cache Socialveo\Core\helpers\LocationHelper
autocompleteSave() Save google autocomplete result to cache Socialveo\Core\helpers\LocationHelper
clearExpired() This method used for clear expired results in database. Socialveo\Core\helpers\LocationHelper
createLocation() Create location by google place id Socialveo\Core\helpers\LocationHelper
geocode() Get google geocode Socialveo\Core\helpers\LocationHelper
geocodeData() Universal geocode (without caching) Socialveo\Core\helpers\LocationHelper
reverseGeocodeData() Reverse geocoding (without caching) Socialveo\Core\helpers\LocationHelper

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
exec() Exec url and return response Socialveo\Core\helpers\LocationHelper
getGeocode() Get geocode and return result Socialveo\Core\helpers\LocationHelper
getPlaceIdFromResponse() Get place_id from response Socialveo\Core\helpers\LocationHelper
optimizeAutocompleteResult() Optimize autocomplete response Socialveo\Core\helpers\LocationHelper
optimizeGeocodeResult() Optimize geocode result Socialveo\Core\helpers\LocationHelper
parseLocationData() Parse geocode result and return array of parsed data by type Socialveo\Core\helpers\LocationHelper
saveLocations() Save locations models Socialveo\Core\helpers\LocationHelper

Method Details

autocomplete() public static method

Google map autocomplete cache

public static array|mixed autocomplete ( $query, $locale null )
$query string
$locale string

[optional]

autocompleteSave() public static method

Save google autocomplete result to cache

public static boolean autocompleteSave ( $query, $result, $locale null )
$query string
$result string|array
$locale string

[optional]

clearExpired() public static method

This method used for clear expired results in database.

Must be used from cron since it can take many time.

public static void clearExpired ( )
createLocation() public static method

Create location by google place id

public static Socialveo\Core\models\Location createLocation ( $place_id, $locale null )
$place_id string

Google place id

$locale string

[optional]

throws Exception
exec() protected static method

Exec url and return response

protected static mixed exec ( $url )
$url string
geocode() public static method

Get google geocode

public static array|null|string geocode ( $place_id, $locale null )
$place_id string
$locale string

[optional]

geocodeData() public static method

Universal geocode (without caching)

public static array|mixed geocodeData ( $type, $data, $locale null, $geocodeType 'geocode' )
$type string
$data array
$locale string

[optional]

$geocodeType string

[optional] Type of geocoding

getGeocode() protected static method

Get geocode and return result

protected static array|null getGeocode ( &$place_id, $locale )
$place_id string
$locale string
getPlaceIdFromResponse() protected static method

Get place_id from response

protected static mixed getPlaceIdFromResponse ( $response )
$response array
optimizeAutocompleteResult() protected static method

Optimize autocomplete response

protected static array optimizeAutocompleteResult ( $response )
$response array
optimizeGeocodeResult() protected static method

Optimize geocode result

protected static array optimizeGeocodeResult ( $response )
$response array
parseLocationData() protected static method

Parse geocode result and return array of parsed data by type

protected static array parseLocationData ( $result )
$result array
reverseGeocodeData() public static method

Reverse geocoding (without caching)

public static array|mixed reverseGeocodeData ( $type, $data, $locale null )
$type string
$data array
$locale string

[optional]

saveLocations() protected static method

Save locations models

protected static void saveLocations ( $location, $data, $locale, $is_default_locale false, &$locations = [] )
$location Socialveo\Core\models\Location
$data array
$locale string
$is_default_locale boolean

[optional]

$locations Socialveo\Core\models\SocialveoModel[]|Socialveo\Core\models\LocationCountry[]|Socialveo\Core\models\LocationRegion[]|Socialveo\Core\models\LocationLocality[]

[optional]