1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
<?php
/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <olivier.laviale@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ICanBoogie\CLDR;
use ICanBoogie\Accessor\AccessorTrait;
/**
* Representation of a locale numbers
*
* @property-read Locale $locale
* @property-read array $symbols Shortcuts to the `symbols-numberSystem-<defaultNumberingSystem>`.
* @property-read array $decimal_formats Shortcuts to the `decimalFormats-numberSystem-<defaultNumberingSystem>`.
* @property-read string $decimal_format Shortcuts to the `decimalFormats-numberSystem-<defaultNumberingSystem>/standard`.
* @property-read array $short_decimal_formats Shortcuts to the `decimalFormats-numberSystem-<defaultNumberingSystem>/short/decimalFormats`.
* @property-read array $long_decimal_formats Shortcuts to the `decimalFormats-numberSystem-<defaultNumberingSystem>/long/decimalFormats`.
* @property-read array $scientific_formats Shortcuts to the `scientificFormats-numberSystem-<defaultNumberingSystem>`.
* @property-read array $percent_formats Shortcuts to the `percentFormats-numberSystem-<defaultNumberingSystem>`.
* @property-read array $currency_formats Shortcuts to the `currencyFormats-numberSystem-<defaultNumberingSystem>`.
* @property-read array $misc_patterns Shortcuts to the `miscPatterns-numberSystem-<defaultNumberingSystem>`.
*/
class Numbers extends \ArrayObject
{
use AccessorTrait;
use LocalePropertyTrait;
/**
* @return array
*/
protected function get_symbols()
{
return $this['symbols-numberSystem-' . $this['defaultNumberingSystem']];
}
/**
* @return array
*/
protected function get_decimal_formats()
{
return $this['decimalFormats-numberSystem-' . $this['defaultNumberingSystem']];
}
/**
* @return string
*/
protected function get_decimal_format()
{
return $this['decimalFormats-numberSystem-' . $this['defaultNumberingSystem']]['standard'];
}
/**
* @return array
*/
protected function get_short_decimal_formats()
{
return $this['decimalFormats-numberSystem-' . $this['defaultNumberingSystem']]['short']['decimalFormat'];
}
/**
* @return array
*/
protected function get_long_decimal_formats()
{
return $this['decimalFormats-numberSystem-' . $this['defaultNumberingSystem']]['long']['decimalFormat'];
}
/**
* @return array
*/
protected function get_scientific_formats()
{
return $this['scientificFormats-numberSystem-' . $this['defaultNumberingSystem']];
}
/**
* @return array
*/
protected function get_percent_formats()
{
return $this['percentFormats-numberSystem-' . $this['defaultNumberingSystem']];
}
/**
* @return array
*/
protected function get_currency_formats()
{
return $this['currencyFormats-numberSystem-' . $this['defaultNumberingSystem']];
}
/**
* @return array
*/
protected function get_misc_patterns()
{
return $this['miscPatterns-numberSystem-' . $this['defaultNumberingSystem']];
}
/**
* Initialize the {@link $locale} property.
*
* @param Locale $locale
* @param array $data
*/
public function __construct(Locale $locale, array $data)
{
$this->locale = $locale;
parent::__construct($data);
}
}