123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace Symfony\Component\Locale\Stub;
- use Symfony\Component\Icu\IcuData;
- use Symfony\Component\Intl\Intl;
- use Symfony\Component\Intl\Locale\Locale;
- class StubLocale extends Locale
- {
-
- protected static $currencies;
-
- protected static $currenciesNames;
-
- public static function getCurrenciesData($locale)
- {
- if (null === self::$currencies) {
- self::prepareCurrencies($locale);
- }
- return self::$currencies;
- }
-
- public static function getDisplayCurrencies($locale)
- {
- if (null === self::$currenciesNames) {
- self::prepareCurrencies($locale);
- }
- return self::$currenciesNames;
- }
-
- public static function getCurrencies()
- {
- return array_keys(self::getCurrenciesData(self::getDefault()));
- }
- public static function getDataDirectory()
- {
- return IcuData::getResourceDirectory();
- }
- private static function prepareCurrencies($locale)
- {
- self::$currencies = array();
- self::$currenciesNames = array();
- $bundle = Intl::getCurrencyBundle();
- foreach ($bundle->getCurrencyNames($locale) as $currency => $name) {
- self::$currencies[$currency] = array(
- 'name' => $name,
- 'symbol' => $bundle->getCurrencySymbol($currency, $locale),
- 'fractionDigits' => $bundle->getFractionDigits($currency),
- 'roundingIncrement' => $bundle->getRoundingIncrement($currency)
- );
- self::$currenciesNames[$currency] = $name;
- }
- }
- }
|