PHP Class CommerceGuys\Addressing\Subdivision\Subdivision

Subdivisions are hierarchical and can have up to three levels: Administrative Area -> Locality -> Dependent Locality.
Mostra file Open project: commerceguys/addressing Class Usage Examples

Protected Properties

Property Type Description
$children The children.
$code string The subdivision code.
$countryCode string The country code.
$isoCode string The subdivision iso code.
$localCode string The local subdivision code.
$localName string The local subdivision name.
$locale string The locale.
$name string The subdivision name.
$parent Subdivision The parent.
$postalCodePattern string The postal code pattern.
$postalCodePatternType string The postal code pattern type.

Public Methods

Method Description
__construct ( array $definition ) Creates a new Subdivision instance.
getChildren ( ) : Subdivision[] Gets the subdivision children.
getCode ( ) : string Gets the subdivision code.
getCountryCode ( ) : string Gets the subdivision country code.
getIsoCode ( ) : string Gets the subdivision ISO 3166-2 code.
getLocalCode ( ) : string | null Gets the subdivision local code.
getLocalName ( ) : string | null Gets the subdivision local name.
getLocale ( ) : string | null Gets the subdivision locale.
getName ( ) : string Gets the subdivision name.
getParent ( ) : Subdivision | null Gets the subdivision parent.
getPostalCodePattern ( ) : string | null Gets the postal code pattern.
getPostalCodePatternType ( ) : string | null Gets the postal code pattern type.
hasChildren ( ) : boolean Checks whether the subdivision has children.

Method Details

__construct() public method

Creates a new Subdivision instance.
public __construct ( array $definition )
$definition array The definition array.

getChildren() public method

Gets the subdivision children.
public getChildren ( ) : Subdivision[]
return Subdivision[] The subdivision children.

getCode() public method

Represents the subdivision on the formatted address. Could be an abbreviation, such as "CA" for California, or a full string such as "Grand Cayman". This is the value that is stored on the address object. Guaranteed to be in latin script.
public getCode ( ) : string
return string The subdivision code.

getCountryCode() public method

This is a CLDR country code, since CLDR includes additional countries for addressing purposes, such as Canary Islands (IC).
public getCountryCode ( ) : string
return string The two-letter country code.

getIsoCode() public method

Only defined for administrative areas. Examples: 'US-CA', 'JP-01'.
public getIsoCode ( ) : string
return string The subdivision ISO 3166-2 code.

getLocalCode() public method

When a country uses a non-latin script, the local code is the code in that script (Cyrilic in Russia, Chinese in China, etc).
public getLocalCode ( ) : string | null
return string | null The subdivision local code, if defined.

getLocalName() public method

When a country uses a non-latin script, the local name is the name in that script (Cyrilic in Russia, Chinese in China, etc).
public getLocalName ( ) : string | null
return string | null The subdivision local name, if defined.

getLocale() public method

Used for selecting local subdivision codes/names. Only defined if the subdivision has a local code or name.
public getLocale ( ) : string | null
return string | null The subdivision locale, if defined.

getName() public method

Represents the subdivision in dropdowns. Guaranteed to be in latin script.
public getName ( ) : string
return string The subdivision name.

getParent() public method

Gets the subdivision parent.
public getParent ( ) : Subdivision | null
return Subdivision | null The parent, or NULL if there is none.

getPostalCodePattern() public method

This is a regular expression pattern used to validate postal codes.
public getPostalCodePattern ( ) : string | null
return string | null The postal code pattern.

getPostalCodePatternType() public method

Gets the postal code pattern type.
public getPostalCodePatternType ( ) : string | null
return string | null The postal code pattern type.

hasChildren() public method

Checks whether the subdivision has children.
public hasChildren ( ) : boolean
return boolean TRUE if the subdivision has children, FALSE otherwise.

Property Details

$children protected_oe property

The children.
protected $children

$code protected_oe property

The subdivision code.
protected string $code
return string

$countryCode protected_oe property

The country code.
protected string $countryCode
return string

$isoCode protected_oe property

The subdivision iso code.
protected string $isoCode
return string

$localCode protected_oe property

The local subdivision code.
protected string $localCode
return string

$localName protected_oe property

The local subdivision name.
protected string $localName
return string

$locale protected_oe property

The locale.
protected string $locale
return string

$name protected_oe property

The subdivision name.
protected string $name
return string

$parent protected_oe property

The parent.
protected Subdivision,CommerceGuys\Addressing\Subdivision $parent
return Subdivision

$postalCodePattern protected_oe property

The postal code pattern.
protected string $postalCodePattern
return string

$postalCodePatternType protected_oe property

The postal code pattern type.
protected string $postalCodePatternType
return string