PHP Класс CommerceGuys\Addressing\Subdivision\SubdivisionRepository

Наследование: implements CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
__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 )

Защищенные методы

Метод Описание
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.

Описание методов

__construct() публичный Метод

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() защищенный Метод

Used for storing a country's subdivisions of a specific level.
protected buildGroup ( array $parents ) : string
$parents array The parents (country code, subdivision codes).
Результат string The group.

createSubdivisionFromDefinitions() защищенный Метод

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.
Результат Subdivision

get() публичный Метод

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

getAll() публичный Метод

public getAll ( array $parents )
$parents array

getList() публичный Метод

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

hasData() защищенный Метод

Checks whether predefined subdivisions exist for the provided parents.
protected hasData ( array $parents ) : boolean
$parents array The parents (country code, subdivision codes).
Результат boolean TRUE if predefined subdivisions exist for the provided parents, FALSE otherwise.

loadDefinitions() защищенный Метод

Loads the subdivision definitions for the provided parents.
protected loadDefinitions ( array $parents ) : array
$parents array The parents (country code, subdivision codes).
Результат array The subdivision definitions.

processDefinitions() защищенный Метод

Adds keys and values that were removed from the JSON files for brevity.
protected processDefinitions ( array $definitions ) : array
$definitions array The definitions.
Результат array The processed definitions.

Описание свойств

$addressFormatRepository защищенное свойство

The address format repository.
protected AddressFormatRepository,CommerceGuys\Addressing\AddressFormat $addressFormatRepository
Результат CommerceGuys\Addressing\AddressFormat\AddressFormatRepository

$definitionPath защищенное свойство

The path where subdivision definitions are stored.
protected string $definitionPath
Результат string

$definitions защищенное свойство

Subdivision definitions.
protected array $definitions
Результат array

$parents защищенное свойство

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
Результат array