MediaWiki fundraising/REL1_35
CldrCurrency Class Reference

A class for getting currency-related data from cldr. More...

Static Public Member Functions

static getCurrenciesByCountry ( $country_code)
 getCurrenciesByCountry returns an ordered list of ISO 4217 3-character currency codes that are valid in the specified country.
 
static getDecimalPlaces ( $currency_code)
 getDecimalPlaces returns a number specifying how many decimal places the requested currency supports.
 
static getSymbol ( $currency_code, $language_code, $country_code=null)
 getSymbol returns a symbol for the relevant currency that should be recognized notation for that currency in the specified language and optionally specified country.
 

Static Private Member Functions

static loadData ( $data)
 Loads the file which contains the relevant data.
 

Static Private Attributes

static $cache = []
 

Detailed Description

A class for getting currency-related data from cldr.

Author
Katie Horn
Note
Copyright © 2007-2013
GPL-2.0-or-later

Definition at line 10 of file CldrCurrencies.php.

Member Function Documentation

◆ getCurrenciesByCountry()

static CldrCurrency::getCurrenciesByCountry ( $country_code)
static

getCurrenciesByCountry returns an ordered list of ISO 4217 3-character currency codes that are valid in the specified country.

Parameters
string$country_codeISO 3166-1 Alpha-2 country code
Returns
array An array of indicies and currency codes, or an empty array if no valid currency is found.

Definition at line 118 of file CldrCurrencies.php.

References loadData().

◆ getDecimalPlaces()

static CldrCurrency::getDecimalPlaces ( $currency_code)
static

getDecimalPlaces returns a number specifying how many decimal places the requested currency supports.

Parameters
string$currency_codeISO 4217 3-character currency code.
Returns
int The number of decimal places for the relevant currency (0 for nonfractional)

Definition at line 134 of file CldrCurrencies.php.

References loadData().

◆ getSymbol()

static CldrCurrency::getSymbol ( $currency_code,
$language_code,
$country_code = null )
static

getSymbol returns a symbol for the relevant currency that should be recognized notation for that currency in the specified language and optionally specified country.

NOTE: This function will always perform more reliably if a country is specified

Parameters
string$currency_codeISO 4217 3-character currency code.
string$language_codeISO 639 2-character language code.
string | null$country_codeISO 3166-1 Alpha-2 country code (optional)
Returns
string The symbol for the specified currency, language, and country

Definition at line 63 of file CldrCurrencies.php.

References loadData().

◆ loadData()

static CldrCurrency::loadData ( $data)
staticprivate

Loads the file which contains the relevant data.

Parameters
string$data'symbols' | 'fractions' | 'locale'
Exceptions
Exception

Definition at line 18 of file CldrCurrencies.php.

Referenced by getCurrenciesByCountry(), getDecimalPlaces(), and getSymbol().

Member Data Documentation

◆ $cache

CldrCurrency::$cache = []
staticprivate

Definition at line 11 of file CldrCurrencies.php.


The documentation for this class was generated from the following file: