PHP Class CommerceGuys\Addressing\Subdivision\SubdivisionRepository

Inheritance: implements CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface
Afficher le fichier Open project: commerceguys/addressing

Protected Properties

Свойство Type Description
$addressFormatRepository CommerceGuys\Addressing\AddressFormat\AddressFormatRepository The address format repository.
$definitionPath string The path where subdivision definitions are stored.
$definitions array Subdivision definitions.
$parents array Used as a cache to speed up instantiating subdivisions with the same parent. Contains only parents instead of all instantiated subdivisions to minimize duplicating the data in $this->definitions, thus reducing memory usage.

Méthodes publiques

Méthode Description
__construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository = null, string $definitionPath = null ) Creates a SubdivisionRepository instance.
get ( $code, array $parents )
getAll ( array $parents )
getList ( array $parents, $locale = null )

Méthodes protégées

Méthode Description
buildGroup ( array $parents ) : string Builds a group from the provided parents.
createSubdivisionFromDefinitions ( integer $code, array $definitions ) : Subdivision Creates a subdivision object from the provided definitions.
hasData ( array $parents ) : boolean Checks whether predefined subdivisions exist for the provided parents.
loadDefinitions ( array $parents ) : array Loads the subdivision definitions for the provided parents.
processDefinitions ( array $definitions ) : array Processes the loaded definitions.

Method Details

__construct() public méthode

Creates a SubdivisionRepository instance.
public __construct ( CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface $addressFormatRepository = null, string $definitionPath = null )
$addressFormatRepository CommerceGuys\Addressing\AddressFormat\AddressFormatRepositoryInterface The address format repository.
$definitionPath string Path to the subdivision definitions.

buildGroup() protected méthode

Used for storing a country's subdivisions of a specific level.
protected buildGroup ( array $parents ) : string
$parents array The parents (country code, subdivision codes).
Résultat string The group.

createSubdivisionFromDefinitions() protected méthode

Creates a subdivision object from the provided definitions.
protected createSubdivisionFromDefinitions ( integer $code, array $definitions ) : Subdivision
$code integer The subdivision code.
$definitions array The subdivision definitions.
Résultat Subdivision

get() public méthode

public get ( $code, array $parents )
$parents array

getAll() public méthode

public getAll ( array $parents )
$parents array

getList() public méthode

public getList ( array $parents, $locale = null )
$parents array

hasData() protected méthode

Checks whether predefined subdivisions exist for the provided parents.
protected hasData ( array $parents ) : boolean
$parents array The parents (country code, subdivision codes).
Résultat boolean TRUE if predefined subdivisions exist for the provided parents, FALSE otherwise.

loadDefinitions() protected méthode

Loads the subdivision definitions for the provided parents.
protected loadDefinitions ( array $parents ) : array
$parents array The parents (country code, subdivision codes).
Résultat array The subdivision definitions.

processDefinitions() protected méthode

Adds keys and values that were removed from the JSON files for brevity.
protected processDefinitions ( array $definitions ) : array
$definitions array The definitions.
Résultat array The processed definitions.

Property Details

$addressFormatRepository protected_oe property

The address format repository.
protected AddressFormatRepository,CommerceGuys\Addressing\AddressFormat $addressFormatRepository
Résultat CommerceGuys\Addressing\AddressFormat\AddressFormatRepository

$definitionPath protected_oe property

The path where subdivision definitions are stored.
protected string $definitionPath
Résultat string

$definitions protected_oe property

Subdivision definitions.
protected array $definitions
Résultat array

$parents protected_oe property

Used as a cache to speed up instantiating subdivisions with the same parent. Contains only parents instead of all instantiated subdivisions to minimize duplicating the data in $this->definitions, thus reducing memory usage.
protected array $parents
Résultat array