You are here

public function NumberFormatter::__construct in Commerce Core 8.2

Constructs a new NumberFormatter object.

Parameters

\CommerceGuys\Intl\NumberFormat\NumberFormatRepositoryInterface $number_format_repository: The number format repository.

\Drupal\commerce\CurrentLocaleInterface $current_locale: The current locale.

array $default_options: The default options.

1 call to NumberFormatter::__construct()
PhysicalNumberFormatter::__construct in modules/price/src/PhysicalNumberFormatter.php
Constructs a new PhysicalNumberFormatter object.
1 method overrides NumberFormatter::__construct()
PhysicalNumberFormatter::__construct in modules/price/src/PhysicalNumberFormatter.php
Constructs a new PhysicalNumberFormatter object.

File

modules/price/src/NumberFormatter.php, line 26

Class

NumberFormatter
Extends the commerceguys/intl NumberFormatter to provide better defaults.

Namespace

Drupal\commerce_price

Code

public function __construct(NumberFormatRepositoryInterface $number_format_repository, CurrentLocaleInterface $current_locale, array $default_options = []) {
  $default_options += [
    'locale' => $current_locale
      ->getLocale()
      ->getLocaleCode(),
  ];
  parent::__construct($number_format_repository, $default_options);
}