You are here

class PhysicalNumberFormatter in Commerce Core 8.2

Wraps the NumberFormatter for use by the Physical Fields module.

Hierarchy

Expanded class hierarchy of PhysicalNumberFormatter

See also

\Drupal\commerce_price\CommercePriceServiceProvider

File

modules/price/src/PhysicalNumberFormatter.php, line 14

Namespace

Drupal\commerce_price
View source
class PhysicalNumberFormatter extends NumberFormatter implements NumberFormatterInterface {

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

}

Members

Namesort descending Modifiers Type Description Overrides
NumberFormatterInterface::format public function Formats the given number for the current language. 1
NumberFormatterInterface::parse public function Parses the given number. 1
PhysicalNumberFormatter::__construct public function Constructs a new PhysicalNumberFormatter object. Overrides NumberFormatter::__construct