GeolocationService
extends Service
in package
Uses
ServiceTrait
This is the geo-location service class.
This class will retrieve the geo-location data from LogiCommerce API and transform them to objects. All the needed geo-location operations previous to Framework must be done here.
Tags
Table of Contents
DELETE | = \SDK\Core\Enums\MethodType::DELETE | |
---|---|---|
GET | = \SDK\Core\Enums\MethodType::GET | |
ITEMS | = 'items' | |
POST | = \SDK\Core\Enums\MethodType::POST | |
PUT | = \SDK\Core\Enums\MethodType::PUT | |
getCountries() | Returns the available countries | : ElementCollection|null |
getInstance() | Returns the requested model instance. | : Service |
getLocalities() | Returns the postal codes of a country/location filtered with the given parameters | : ElementCollection|null |
getLocationPath() | Returns an array with the locations that form the path to the parameters given location | : ElementCollection|null |
getLocations() | Returns the locations of a country filtered with the given parameters | : ElementCollection|null |
__construct() | : mixed | |
call() | : array<string|int, mixed> | |
extractParameters() | : array<string|int, mixed> | |
getCollection() | : mixed | |
getConnection() | : Connection | |
getElement() | : Element|null | |
getElements() | : ElementCollection|null | |
getResourceElement() | : Element|null | |
getResponse() | : ElementCollection|null | |
prepareElement() | : Element|null | |
prepareElements() | : array<string|int, mixed> | |
replaceWildcards() | : string |
Constants
DELETE
protected
mixed
DELETE
= \SDK\Core\Enums\MethodType::DELETE
GET
protected
mixed
GET
= \SDK\Core\Enums\MethodType::GET
ITEMS
protected
mixed
ITEMS
= 'items'
POST
protected
mixed
POST
= \SDK\Core\Enums\MethodType::POST
PUT
protected
mixed
PUT
= \SDK\Core\Enums\MethodType::PUT
Methods
getCountries()
Returns the available countries
public
getCountries([string $languageCode = null ]) : ElementCollection|null
Parameters
- $languageCode : string = null
-
Optional. String that sets the language for the countries to be returned.
Return values
ElementCollection|null —getInstance()
Returns the requested model instance.
public
static getInstance() : Service
If is not setted, this method will set it.
Return values
Service —getLocalities()
Returns the postal codes of a country/location filtered with the given parameters
public
getLocalities([LocalitiesParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : LocalitiesParametersGroup = null
-
object with the needed filters to send to the API Geolocation resource
Return values
ElementCollection|null —getLocationPath()
Returns an array with the locations that form the path to the parameters given location
public
getLocationPath([LocationPathParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : LocationPathParametersGroup = null
-
object with the needed filters to send to the API Geolocation resource
Return values
ElementCollection|null —getLocations()
Returns the locations of a country filtered with the given parameters
public
getLocations([LocationParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : LocationParametersGroup = null
-
object with the needed filters to send to the API Geolocation resource
Return values
ElementCollection|null —__construct()
protected
__construct() : mixed
Return values
mixed —call()
protected
call(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>
Parameters
- $request : Request
- $apiUrl : string = null
Return values
array<string|int, mixed> —extractParameters()
protected
extractParameters([ParametersGroup|null $parametersGroup = null ]) : array<string|int, mixed>
Parameters
- $parametersGroup : ParametersGroup|null = null
Return values
array<string|int, mixed> —getCollection()
protected
getCollection(array<string|int, mixed> $data, string $class) : mixed
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
mixed —getConnection()
protected
getConnection() : Connection
Return values
Connection —getElement()
protected
getElement(string $class, string $resource[, int $id = null ][, mixed $params = null ]) : Element|null
Parameters
- $class : string
- $resource : string
- $id : int = null
- $params : mixed = null
Return values
Element|null —getElements()
protected
getElements(string $class, string $resource[, ParametersGroup $parameters = null ]) : ElementCollection|null
Parameters
- $class : string
- $resource : string
- $parameters : ParametersGroup = null
Return values
ElementCollection|null —getResourceElement()
protected
getResourceElement(string $class, string $resource[, mixed $params = [] ]) : Element|null
Parameters
- $class : string
- $resource : string
- $params : mixed = []
Return values
Element|null —getResponse()
protected
getResponse(array<string|int, mixed> $data, string $class) : ElementCollection|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
ElementCollection|null —prepareElement()
protected
prepareElement(array<string|int, mixed> $data, string $class) : Element|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
Element|null —prepareElements()
protected
prepareElements(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
array<string|int, mixed> —replaceWildcards()
protected
replaceWildcards(string $resource, array<string|int, mixed> $wildcards) : string
Parameters
- $resource : string
- $wildcards : array<string|int, mixed>