Example #1
0
 /**
  * Gets value of numeric attribute of \NumberFormatter
  *
  * @param string|int $attribute
  * @param string|null $style
  * @param string|null $locale
  * @return int
  */
 public function getAttribute($attribute, $style = null, $locale = null)
 {
     return $this->formatter->getAttribute($attribute, $style, $locale);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $currencyCode = $this->localeSettings->getCurrency();
     $currencySymbol = $this->localeSettings->getCurrencySymbolByCurrency($currencyCode);
     $resolver->setDefaults(array('currency' => $currencyCode, 'currency_symbol' => $currencySymbol, 'grouping' => (bool) $this->numberFormatter->getAttribute(\NumberFormatter::GROUPING_USED), 'constraints' => array(new LessThan(array('value' => pow(10, 15))))));
 }
 /**
  * @dataProvider getAttributeDataProvider
  */
 public function testGetAttribute($attribute, $style, $locale, $expected)
 {
     $this->assertSame($expected, $this->formatter->getAttribute($attribute, $style, $locale));
 }