PHP Класс Monarobase\CountryList\CountryList

Автор: Monarobase ([email protected])
Показать файл Открыть проект

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

Свойство Тип Описание
$dataCache array Cached data.
$dataDir string Path to the directory containing countries data.
$dataSources array Available data sources.

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

Метод Описание
__construct ( string | null $dataDir = null ) Constructor.
getDataDir ( ) : string
getList ( string $locale = 'en', string $format = 'php', string $source = 'cldr' ) : array Returns a list of countries.
getOne ( string $countryCode, string $locale = 'en', string $source = 'cldr' ) : string Returns one country.
has ( string $countryCode, string $locale = 'en', string $source = 'cldr' ) : boolean Indicates whether or not a given $countryCode matches a country.
setList ( string $locale, string $source, array $data ) : CountryList

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

Метод Описание
loadData ( string $locale, string $source, string $format ) : array A lazy-loader that loads data from a PHP file if it is not stored in memory yet.
sortData ( string $locale, array $data ) : array Sorts the data array for a given locale, using the locale translations.

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

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

Constructor.
public __construct ( string | null $dataDir = null )
$dataDir string | null Path to the directory containing countries data

getDataDir() публичный метод

public getDataDir ( ) : string
Результат string The country data directory.

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

Returns a list of countries.
public getList ( string $locale = 'en', string $format = 'php', string $source = 'cldr' ) : array
$locale string The locale (default: en)
$format string The format (default: php)
$source string Data source: "icu" or "cldr"
Результат array

getOne() публичный метод

Returns one country.
public getOne ( string $countryCode, string $locale = 'en', string $source = 'cldr' ) : string
$countryCode string The country
$locale string The locale (default: en)
$source string Data source: "icu" or "cldr"
Результат string

has() публичный метод

Indicates whether or not a given $countryCode matches a country.
public has ( string $countryCode, string $locale = 'en', string $source = 'cldr' ) : boolean
$countryCode string A 2-letter country code
$locale string The locale (default: en)
$source string Data source: "icu" or "cldr"
Результат boolean true if a match was found, false otherwise

loadData() защищенный метод

A lazy-loader that loads data from a PHP file if it is not stored in memory yet.
protected loadData ( string $locale, string $source, string $format ) : array
$locale string The locale
$source string Data source
$format string The format (default: php)
Результат array An array (list) with country

setList() публичный метод

public setList ( string $locale, string $source, array $data ) : CountryList
$locale string The locale
$source string Data source
$data array An array (list) with country data
Результат CountryList The instance of CountryList to enable fluent interface

sortData() защищенный метод

It is UTF-8 aware if the Collator class is available (requires the intl extension).
protected sortData ( string $locale, array $data ) : array
$locale string The locale whose collation rules should be used.
$data array Array of strings to sort.
Результат array The $data array, sorted.

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

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

Cached data.
protected array $dataCache
Результат array

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

Path to the directory containing countries data.
protected string $dataDir
Результат string

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

Available data sources.
protected array $dataSources
Результат array