class Location implements LocationInterface

Properties

protected Coordinates|null $coordinates
protected Bounds|null $bounds
protected string|int|null $streetNumber
protected string|null $streetName
protected string|null $subLocality
protected string|null $locality
protected string|null $postalCode
protected AdminLevelCollection $adminLevels
protected string|null $countryName
protected string|null $countryCode
protected string|null $formattedAddress
protected string|null $timezone
protected string $providedBy
protected $data

Methods

__construct(string $providedBy, array $data = [])

No description

static Location
createFromArray(array $data)

Create an Address with an array.

isValid()

No description

format(string $mapping = '%n %S %L %z')

No description

null|string
getFormattedAddress()

No description

withFormattedAddress(string $formattedAddress = null)

No description

setBounds(float $south, float $west, float $north, float $east)

No description

setCoordinates(float $latitude, float $longitude)

No description

addAdminLevel(int $level, string $name, string $code = null)

No description

setStreetNumber(null|string $streetNumber)

No description

setStreetName(null|string $streetName)

No description

setLocality(null|string $locality)

No description

setPostalCode(null|string $postalCode)

No description

setSubLocality(null|string $subLocality)

No description

setAdminLevels(array $adminLevels)

No description

setCountryName(null|string $countryName)

No description

setCountryCode(null|string $countryCode)

No description

setTimezone(null|string $timezone)

No description

setValue(string $name, mixed $value)

No description

mixed
getValue(string $name, mixed|null $default = null)

No description

bool
hasValue(string $name)

No description

string
getProvidedBy()

No description

getCoordinates()

Will always return the coordinates value object.

Bounds|null
getBounds()

Returns the bounds value object.

string|int|null
getStreetNumber()

Returns the street number value.

string|null
getStreetName()

Returns the street name value.

string|null
getLocality()

Returns the city or locality value.

string|null
getPostalCode()

Returns the postal code or zipcode value.

string|null
getSubLocality()

Returns the locality district, or sublocality, or neighborhood.

getAdminLevels()

Returns the administrative levels.

string|null
getCountryName()

Returns the country name.

string|null
getCountryCode()

Returns the country code.

string|null
getTimezone()

Returns the timezone for the Location. The timezone MUST be in the list of supported timezones.

hasCoordinates()

No description

array
toArray()

Returns an array with data indexed by name.

fillFromData(array $data)

No description

createCoordinates($data)

No description

Bounds|null
createBounds($data)

No description

array
mergeWithDefaults(array $data)

No description

makeAdminLevels(array $data)

No description

Details

at line 82
__construct(string $providedBy, array $data = [])

No description

Parameters

string $providedBy
array $data

at line 95
static Location createFromArray(array $data)

Create an Address with an array.

Parameters

array $data

Return Value

Location

at line 100
isValid()

No description

at line 105
format(string $mapping = '%n %S %L %z')

No description

Parameters

string $mapping

at line 113
null|string getFormattedAddress()

No description

Return Value

null|string

at line 123
Location withFormattedAddress(string $formattedAddress = null)

No description

Parameters

string $formattedAddress

Return Value

Location

at line 139
Location setBounds(float $south, float $west, float $north, float $east)

No description

Parameters

float $south
float $west
float $north
float $east

Return Value

Location

at line 157
Location setCoordinates(float $latitude, float $longitude)

No description

Parameters

float $latitude
float $longitude

Return Value

Location

at line 176
Location addAdminLevel(int $level, string $name, string $code = null)

No description

Parameters

int $level
string $name
string $code

Return Value

Location

at line 188
Location setStreetNumber(null|string $streetNumber)

No description

Parameters

null|string $streetNumber

Return Value

Location

at line 200
Location setStreetName(null|string $streetName)

No description

Parameters

null|string $streetName

Return Value

Location

at line 212
Location setLocality(null|string $locality)

No description

Parameters

null|string $locality

Return Value

Location

at line 224
Location setPostalCode(null|string $postalCode)

No description

Parameters

null|string $postalCode

Return Value

Location

at line 236
Location setSubLocality(null|string $subLocality)

No description

Parameters

null|string $subLocality

Return Value

Location

at line 248
Location setAdminLevels(array $adminLevels)

No description

Parameters

array $adminLevels

Return Value

Location

at line 260
Location setCountryName(null|string $countryName)

No description

Parameters

null|string $countryName

Return Value

Location

at line 272
Location setCountryCode(null|string $countryCode)

No description

Parameters

null|string $countryCode

Return Value

Location

at line 284
Location setTimezone(null|string $timezone)

No description

Parameters

null|string $timezone

Return Value

Location

at line 297
Location setValue(string $name, mixed $value)

No description

Parameters

string $name
mixed $value

Return Value

Location

at line 310
mixed getValue(string $name, mixed|null $default = null)

No description

Parameters

string $name
mixed|null $default

Return Value

mixed

at line 324
bool hasValue(string $name)

No description

Parameters

string $name

Return Value

bool

at line 332
string getProvidedBy()

No description

Return Value

string

at line 340
Coordinates|null getCoordinates()

Will always return the coordinates value object.

Return Value

Coordinates|null

at line 348
Bounds|null getBounds()

Returns the bounds value object.

Return Value

Bounds|null

at line 356
string|int|null getStreetNumber()

Returns the street number value.

Return Value

string|int|null

at line 364
string|null getStreetName()

Returns the street name value.

Return Value

string|null

at line 372
string|null getLocality()

Returns the city or locality value.

Return Value

string|null

at line 380
string|null getPostalCode()

Returns the postal code or zipcode value.

Return Value

string|null

at line 388
string|null getSubLocality()

Returns the locality district, or sublocality, or neighborhood.

Return Value

string|null

at line 396
AdminLevelCollection getAdminLevels()

Returns the administrative levels.

This method MUST NOT return null.

Return Value

AdminLevelCollection

at line 404
string|null getCountryName()

Returns the country name.

Return Value

string|null

at line 412
string|null getCountryCode()

Returns the country code.

Return Value

string|null

at line 420
string|null getTimezone()

Returns the timezone for the Location. The timezone MUST be in the list of supported timezones.

http://php.net/manual/en/timezones.php

Return Value

string|null

at line 425
hasCoordinates()

No description

at line 438
array toArray()

Returns an array with data indexed by name.

Return Value

array

at line 474
protected fillFromData(array $data)

No description

Parameters

array $data

at line 496
protected Coordinates|null createCoordinates($data)

No description

Parameters

$data

Return Value

Coordinates|null

at line 512
protected Bounds|null createBounds($data)

No description

Parameters

$data

Return Value

Bounds|null

at line 523
protected array mergeWithDefaults(array $data)

No description

Parameters

array $data

Return Value

array

at line 549
protected makeAdminLevels(array $data)

No description

Parameters

array $data