PHP 클래스 Monarobase\CountryList\CountryList

저자: Monarobase ([email protected])
파일 보기 프로젝트 열기: monarobase/country-list

보호된 프로퍼티들

프로퍼티 타입 설명
$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