GeolocationResult
class GeolocationResult implements JsonSerializable (View source)
Constants
ERR_NONE |
Error category: no error. |
ERR_OTHER |
Error category: other/unknown error category. |
ERR_NOCURRENTLIBRARY |
Error category: no current geolocation library. |
ERR_NOCURRENTIPADDRESS |
Error category: the IP address of the current client is not available. |
ERR_IPNOTPUBLIC |
Error category: the IP address is not in the public IP address ranges. |
ERR_MISCONFIGURED |
Error category: the geolocation library has a wrong configuration. |
ERR_NETWORK |
Error category: a network error occurred. |
ERR_LIBRARYSPECIFIC |
Error category: a library-specific error occurred. |
Properties
protected int | $errorCode | The error category (one of the GeolocationResult::ERR_... constants). |
|
protected string | $errorMessage | The error message. |
|
protected Exception|null | $innerException | The underlying exception causing the error (if available). |
|
protected string | $cityName | The city name. |
|
protected string | $stateProvinceCode | The code of the province/state. |
|
protected string | $stateProvinceName | The name of the province/state (in American English). |
|
protected string | $postalCode | The postal code. |
|
protected string | $countryCode | The code of the country (two letter upper case ISO-3166 code). |
|
protected string | $countryName | The name of the country (in American English). |
|
protected float|null | $latitude | The latitude. |
|
protected float|null | $longitude | The longitude. |
Methods
Does an error occurred?
Get the error category (one of the GeolocationResult::ERR_... constants).
Get the error message ().
Get the underlying exception causing the error (if available).
Get the city name.
Set the city name.
Get the code of the province/state.
Set the code of the province/state.
Get the name of the province/state (in American English).
Set the name of the province/state (in American English).
Get the postal code.
Set the postal code.
Get the code of the country (two letter upper case ISO-3166 code).
Set the code of the country (two letter upper case ISO-3166 code).
Get the name of the country (in American English).
Get the name of the country (in the current language).
Set the name of the country (in American English).
Get the latitude.
Set the latitude.
Get the longitude.
Set the longitude.
Does this instance contain some geolocalized data?
{@inheritdoc}
Details
setError(int $code, string $message = '', Exception $innerException = null)
Set the error state.
bool
hasError()
Does an error occurred?
int
getErrorCode()
Get the error category (one of the GeolocationResult::ERR_... constants).
string
getErrorMessage()
Get the error message ().
Exception|null
getInnerException()
Get the underlying exception causing the error (if available).
string
getCityName()
Get the city name.
$this
setCityName(string $value)
Set the city name.
string
getStateProvinceCode()
Get the code of the province/state.
$this
setStateProvinceCode(string $value)
Set the code of the province/state.
string
getStateProvinceName()
Get the name of the province/state (in American English).
$this
setStateProvinceName(string $value)
Set the name of the province/state (in American English).
string
getPostalCode()
Get the postal code.
$this
setPostalCode(string $value)
Set the postal code.
string
getCountryCode()
Get the code of the country (two letter upper case ISO-3166 code).
$this
setCountryCode(string $value)
Set the code of the country (two letter upper case ISO-3166 code).
string
getCountryName(bool $resolveFromCodeIfUnavailable = false)
Get the name of the country (in American English).
string
getCountryNameLocalized()
Get the name of the country (in the current language).
$this
setCountryName(string $value)
Set the name of the country (in American English).
float|null
getLatitude()
Get the latitude.
$this
setLatitude(float|null $value)
Set the latitude.
float|null
getLongitude()
Get the longitude.
$this
setLongitude(float|null $value)
Set the longitude.
bool
hasData()
Does this instance contain some geolocalized data?
jsonSerialize()
{@inheritdoc}