You are here

class NumberFormatter in Price 3.x

Same name and namespace in other branches
  1. 8 src/NumberFormatter.php \Drupal\price\NumberFormatter
  2. 2.0.x src/NumberFormatter.php \Drupal\price\NumberFormatter
  3. 2.x src/NumberFormatter.php \Drupal\price\NumberFormatter
  4. 3.0.x src/NumberFormatter.php \Drupal\price\NumberFormatter

Extends the commerceguys/intl NumberFormatter to provide better defaults.

Hierarchy

  • class \Drupal\price\NumberFormatter extends \CommerceGuys\Intl\Formatter\NumberFormatter

Expanded class hierarchy of NumberFormatter

See also

\CommerceGuys\Intl\Formatter\NumberFormatterInterface

1 string reference to 'NumberFormatter'
price.services.yml in ./price.services.yml
price.services.yml
1 service uses NumberFormatter
price.number_formatter in ./price.services.yml
Drupal\price\NumberFormatter

File

src/NumberFormatter.php, line 14

Namespace

Drupal\price
View source
class NumberFormatter extends ExternalNumberFormatter {

  /**
   * Constructs a new NumberFormatter object.
   *
   * @param \CommerceGuys\Intl\NumberFormat\NumberFormatRepositoryInterface $number_format_repository
   *   The number format repository.
   * @param \Drupal\price\CurrentLocaleInterface $current_locale
   *   The current locale.
   */
  public function __construct(NumberFormatRepositoryInterface $number_format_repository, CurrentLocaleInterface $current_locale) {
    $default_options = [
      'locale' => $current_locale
        ->getLocale()
        ->getLocaleCode(),
    ];
    parent::__construct($number_format_repository, $default_options);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NumberFormatter::__construct public function Constructs a new NumberFormatter object.