PHP Class CommerceGuys\Addressing\AddressFormat\AddressFormat

Afficher le fichier Open project: commerceguys/addressing Class Usage Examples

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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 méthode

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

getAdministrativeAreaType() public méthode

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

getCountryCode() public méthode

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

getDependentLocalityType() public méthode

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

getFormat() public méthode

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
Résultat string The format string.

getLocalFormat() public méthode

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
Résultat string | null The local format string, if defined.

getLocale() public méthode

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

getLocalityType() public méthode

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

getPostalCodePattern() public méthode

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
Résultat string | null The postal code pattern.

getPostalCodePrefix() public méthode

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
Résultat string | null The postal code prefix.

getPostalCodeType() public méthode

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

getRequiredFields() public méthode

Gets the list of required fields.
public getRequiredFields ( ) : array
Résultat array An array of address fields.

getSubdivisionDepth() public méthode

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
Résultat 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 méthode

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

getUsedFields() public méthode

Gets the list of used fields.
public getUsedFields ( ) : array
Résultat array An array of address fields.

getUsedSubdivisionFields() public méthode

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

Property Details

$administrativeAreaType protected_oe property

The administrative area type.
protected string $administrativeAreaType
Résultat string

$countryCode protected_oe property

The country code.
protected string $countryCode
Résultat string

$dependentLocalityType protected_oe property

The dependent locality type.
protected string $dependentLocalityType
Résultat string

$format protected_oe property

The format string.
protected string $format
Résultat string

$groupedFields protected_oe property

The used fields, grouped by line.
protected array $groupedFields
Résultat array

$localFormat protected_oe property

The local format string.
protected string $localFormat
Résultat string

$locale protected_oe property

The locale.
protected string $locale
Résultat string

$localityType protected_oe property

The locality type.
protected string $localityType
Résultat string

$postalCodePattern protected_oe property

The postal code pattern.
protected string $postalCodePattern
Résultat string

$postalCodePrefix protected_oe property

The postal code prefix.
protected string $postalCodePrefix
Résultat string

$postalCodeType protected_oe property

The postal code type.
protected string $postalCodeType
Résultat string

$requiredFields protected_oe property

The required fields.
protected array $requiredFields
Résultat array

$subdivisionDepth protected_oe property

The subdivision depth.
protected int $subdivisionDepth
Résultat integer

$uppercaseFields protected_oe property

The fields that need to be uppercased.
protected string $uppercaseFields
Résultat string

$usedFields protected_oe property

The used fields.
protected array $usedFields
Résultat array