Punic v3.5.0
  • Namespace
  • Class
  • Tree
  • Todo
  • Deprecated

Namespaces

  • Punic
    • Exception

Classes

  • Calendar
  • Comparer
  • Currency
  • Data
  • Language
  • Misc
  • Number
  • Phone
  • Plural
  • Territory
  • Unit

Exceptions

  • Exception

Class Data

Common data helper stuff.

Namespace: Punic
Located at Data.php

Methods summary

public static string
# getDefaultLocale( )

Return the current default locale.

Return the current default locale.

Returns

string
public static string
# getDefaultLanguage( )

Return the current default language.

Return the current default language.

Returns

string
public static
# setDefaultLocale( string $locale )

Set the current default locale and language.

Set the current default locale and language.

Parameters

$locale

Throws

Punic\Exception\InvalidLocale
Throws an exception if $locale is not a valid string
public static string
# getFallbackLocale( )

Return the current fallback locale (used if default locale is not found).

Return the current fallback locale (used if default locale is not found).

Returns

string
public static string
# getFallbackLanguage( )

Return the current fallback language (used if default locale is not found).

Return the current fallback language (used if default locale is not found).

Returns

string
public static
# setFallbackLocale( string $locale )

Set the current fallback locale and language.

Set the current fallback locale and language.

Parameters

$locale

Throws

Punic\Exception\InvalidLocale
Throws an exception if $locale is not a valid string
public static array
# getOverrides( null|mixed $locale = null )

Get custom overrides of CLDR locale data.

Get custom overrides of CLDR locale data.

If a locale is specified, overrides for that locale are returned, indexed by identifier. If no locale is specified, overrides for all locales are returned index by locale.

Parameters

$locale

Returns

array
Associative array
public static
# setOverrides( array $overrides, string $locale = null )

Set custom overrides of CLDR locale data.

Set custom overrides of CLDR locale data.

Overrides may be provides either one locale at a time or all locales at once.

Parameters

$overrides
Associative array index by locale (if $locale is null) or identifier
$locale
public static array
# getOverridesGeneric( )

Get custom overrides of CLDR generic data.

Get custom overrides of CLDR generic data.

Returns

array
Associative array indexed by identifier
public static
# setOverridesGeneric( array $overrides, array $overrides,… )

Set custom overrides of CLDR locale.

Set custom overrides of CLDR locale.

Parameters

$overrides
array indexed by identifier
$overrides,…
public static string
# getDataDirectory( )

Get the data root directory.

Get the data root directory.

Returns

string
public static
# setDataDirectory( string $directory )

Set the data root directory.

Set the data root directory.

Parameters

$directory
public static array
# getAvailableLocales( boolean $allowGroups = false )

Return a list of available locale identifiers.

Return a list of available locale identifiers.

Parameters

$allowGroups
Set to true if you want to retrieve locale groups (eg. 'en-001'), false otherwise

Returns

array
public static string
# guessFullLocale( string $language = '', string $script = '' )

Try to guess the full locale (with script and territory) ID associated to a language.

Try to guess the full locale (with script and territory) ID associated to a language.

Parameters

$language
The language identifier (if empty we'll use the current default language)
$script
The script identifier (if $language is empty we'll use the current default script)

Returns

string
Returns an empty string if the territory was not found, the territory ID otherwise
public static string
# getTerritory( string $locale = '', boolean $checkFallbackLocale = true )

Return the terrotory associated to the locale (guess it if it's not present in $locale).

Return the terrotory associated to the locale (guess it if it's not present in $locale).

Parameters

$locale
The locale identifier (if empty we'll use the current default locale)
$checkFallbackLocale
Set to true to check the fallback locale if $locale (or the default locale) don't have an associated territory, false to don't fallback to fallback locale

Returns

string
public static mixed|null
# getArrayValue( array $data, array $path )

Get value from nested array.

Get value from nested array.

Parameters

$data
the nested array to descend into
$path
Path of array keys. Each part of the path may be a string or an array of alternative strings.

Returns

mixed|null
Punic v3.5.0 API documentation generated by ApiGen