PHP Class CommerceGuys\Addressing\AddressFormat\AddressFormat

Datei anzeigen Open project: commerceguys/addressing Class Usage Examples

Protected Properties

Property Type Description
$administrativeAreaType string The administrative area type.
$countryCode string The country code.
$dependentLocalityType string The dependent locality type.
$format string The format string.
$groupedFields array The used fields, grouped by line.
$localFormat string The local format string.
$locale string The locale.
$localityType string The locality type.
$postalCodePattern string The postal code pattern.
$postalCodePrefix string The postal code prefix.
$postalCodeType string The postal code type.
$requiredFields array The required fields.
$subdivisionDepth integer The subdivision depth.
$uppercaseFields string The fields that need to be uppercased.
$usedFields array The used fields.

Public Methods

Method Description
__construct ( array $definition ) Creates a new AddressFormat instance.
getAdministrativeAreaType ( ) : string | null Gets the administrative area type.
getCountryCode ( ) : string Gets the two-letter country code.
getDependentLocalityType ( ) : string | null Gets the dependent locality type.
getFormat ( ) : string Gets the format string.
getLocalFormat ( ) : string | null Gets the local format string.
getLocale ( ) : string | null Gets the locale.
getLocalityType ( ) : string | null Gets the locality type.
getPostalCodePattern ( ) : string | null Gets the postal code pattern.
getPostalCodePrefix ( ) : string | null Gets the postal code prefix.
getPostalCodeType ( ) : string | null Gets the postal code type.
getRequiredFields ( ) : array Gets the list of required fields.
getSubdivisionDepth ( ) : integer Gets the subdivision depth.
getUppercaseFields ( ) : array Gets the list of fields that need to be uppercased.
getUsedFields ( ) : array Gets the list of used fields.
getUsedSubdivisionFields ( ) : array Gets the list of used subdivision fields.

Method Details

__construct() public method

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

getAdministrativeAreaType() public method

Used for presenting the correct label to the end-user.
public getAdministrativeAreaType ( ) : string | null
return string | null The administrative area type, or null if the administrative area field isn't used.

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.

getDependentLocalityType() public method

Used for presenting the correct label to the end-user.
public getDependentLocalityType ( ) : string | null
return string | null The dependent locality type, or null if the dependent locality field isn't used.

getFormat() public method

Defines the layout of an address, and consists of tokens (address fields prefixed with a '%') separated by unix newlines (\n). Example: %givenName %familyName %organization %addressLine1 %addressLine2 %locality %administrativeArea %postalCode
public getFormat ( ) : string
return string The format string.

getLocalFormat() public method

Defined for countries that use a different ordering of fields when the address is entered in the native script. For example, China uses a major-to-minor format (country first, name last) when the address is entered in Chinese.
public getLocalFormat ( ) : string | null
return string | null The local format string, if defined.

getLocale() public method

Only defined if the country has a local format.
public getLocale ( ) : string | null
return string | null The locale, if defined.

getLocalityType() public method

Used for presenting the correct label to the end-user.
public getLocalityType ( ) : string | null
return string | null The locality type, or null if the locality field isn't used.

getPostalCodePattern() public method

This is a regular expression pattern used to validate postal codes. Ignored if a subdivision defines its own full postal code pattern (E.g. Hong Kong when specified as a Chinese province).
public getPostalCodePattern ( ) : string | null
return string | null The postal code pattern.

getPostalCodePrefix() public method

The prefix is optional and added to postal codes only when formatting an address for international mailing, as recommended by postal services.
public getPostalCodePrefix ( ) : string | null
return string | null The postal code prefix.

getPostalCodeType() public method

Used for presenting the correct label to the end-user.
public getPostalCodeType ( ) : string | null
return string | null The postal code type, or null if the postal code field isn't used.

getRequiredFields() public method

Gets the list of required fields.
public getRequiredFields ( ) : array
return array An array of address fields.

getSubdivisionDepth() public method

Indicates the number of levels of predefined subdivisions. Note that a country might use a subdivision field without having predefined subdivisions for it. For example, if the locality field is used by the address format, but the subdivision depth is 1, that means that the field element should be rendered as a textbox, since there's no known data to put in a dropdown. It is also possible to have no subdivisions for specific parents, even though the country generally has predefined subdivisions at that depth.
public getSubdivisionDepth ( ) : integer
return integer The subdivision depth. Possible values: 0: no subdivisions have been predefined. 1: administrative areas. 2: administrative areas, localities. 3: administrative areas, localities, dependent localities.

getUppercaseFields() public method

Gets the list of fields that need to be uppercased.
public getUppercaseFields ( ) : array
return array An array of address fields.

getUsedFields() public method

Gets the list of used fields.
public getUsedFields ( ) : array
return array An array of address fields.

getUsedSubdivisionFields() public method

Gets the list of used subdivision fields.
public getUsedSubdivisionFields ( ) : array
return array An array of address fields.

Property Details

$administrativeAreaType protected_oe property

The administrative area type.
protected string $administrativeAreaType
return string

$countryCode protected_oe property

The country code.
protected string $countryCode
return string

$dependentLocalityType protected_oe property

The dependent locality type.
protected string $dependentLocalityType
return string

$format protected_oe property

The format string.
protected string $format
return string

$groupedFields protected_oe property

The used fields, grouped by line.
protected array $groupedFields
return array

$localFormat protected_oe property

The local format string.
protected string $localFormat
return string

$locale protected_oe property

The locale.
protected string $locale
return string

$localityType protected_oe property

The locality type.
protected string $localityType
return string

$postalCodePattern protected_oe property

The postal code pattern.
protected string $postalCodePattern
return string

$postalCodePrefix protected_oe property

The postal code prefix.
protected string $postalCodePrefix
return string

$postalCodeType protected_oe property

The postal code type.
protected string $postalCodeType
return string

$requiredFields protected_oe property

The required fields.
protected array $requiredFields
return array

$subdivisionDepth protected_oe property

The subdivision depth.
protected int $subdivisionDepth
return integer

$uppercaseFields protected_oe property

The fields that need to be uppercased.
protected string $uppercaseFields
return string

$usedFields protected_oe property

The used fields.
protected array $usedFields
return array