/**
* Helps manage intl conversions
+ *
+ * @TODO Makes this class strict !!!
*/
class IntlUtil {
/**
$date = twig_date_converter($env, $date, $timezone);
$formatValues = array(
- 'none' => IntlDateFormatter::NONE,
- 'short' => IntlDateFormatter::SHORT,
- 'medium' => IntlDateFormatter::MEDIUM,
- 'long' => IntlDateFormatter::LONG,
- 'full' => IntlDateFormatter::FULL,
+ 'none' => \IntlDateFormatter::NONE,
+ 'short' => \IntlDateFormatter::SHORT,
+ 'medium' => \IntlDateFormatter::MEDIUM,
+ 'long' => \IntlDateFormatter::LONG,
+ 'full' => \IntlDateFormatter::FULL,
);
- $formatter = IntlDateFormatter::create(
+ $formatter = \IntlDateFormatter::create(
$locale,
$formatValues[$dateFormat],
$formatValues[$timeFormat],
- IntlTimeZone::createTimeZone($date->getTimezone()->getName()),
- 'gregorian' === $calendar ? IntlDateFormatter::GREGORIAN : IntlDateFormatter::TRADITIONAL,
+ \IntlTimeZone::createTimeZone($date->getTimezone()->getName()),
+ 'gregorian' === $calendar ? \IntlDateFormatter::GREGORIAN : \IntlDateFormatter::TRADITIONAL,
$format
);
*
* @return NumberFormatter A NumberFormatter instance
*/
- protected function getNumberFormatter($locale, $style): NumberFormatter {
+ protected function getNumberFormatter($locale, $style): \NumberFormatter {
static $formatter, $currentStyle;
$locale = null !== $locale ? $locale : Locale::getDefault();
}
static $styleValues = array(
- 'decimal' => NumberFormatter::DECIMAL,
- 'currency' => NumberFormatter::CURRENCY,
- 'percent' => NumberFormatter::PERCENT,
- 'scientific' => NumberFormatter::SCIENTIFIC,
- 'spellout' => NumberFormatter::SPELLOUT,
- 'ordinal' => NumberFormatter::ORDINAL,
- 'duration' => NumberFormatter::DURATION,
+ 'decimal' => \NumberFormatter::DECIMAL,
+ 'currency' => \NumberFormatter::CURRENCY,
+ 'percent' => \NumberFormatter::PERCENT,
+ 'scientific' => \NumberFormatter::SCIENTIFIC,
+ 'spellout' => \NumberFormatter::SPELLOUT,
+ 'ordinal' => \NumberFormatter::ORDINAL,
+ 'duration' => \NumberFormatter::DURATION,
);
if (!isset($styleValues[$style])) {
$currentStyle = $style;
- $formatter = NumberFormatter::create($locale, $styleValues[$style]);
+ $formatter = \NumberFormatter::create($locale, $styleValues[$style]);
return $formatter;
}