class PhysicalNumberFormatter in Commerce Core 8.2
Wraps the NumberFormatter for use by the Physical Fields module.
Hierarchy
- class \Drupal\commerce_price\NumberFormatter extends \CommerceGuys\Intl\Formatter\NumberFormatter
- class \Drupal\commerce_price\PhysicalNumberFormatter implements NumberFormatterInterface
Expanded class hierarchy of PhysicalNumberFormatter
See also
\Drupal\commerce_price\CommercePriceServiceProvider
File
- modules/
price/ src/ PhysicalNumberFormatter.php, line 14
Namespace
Drupal\commerce_priceView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NumberFormatterInterface:: |
public | function | Formats the given number for the current language. | 1 |
NumberFormatterInterface:: |
public | function | Parses the given number. | 1 |
PhysicalNumberFormatter:: |
public | function |
Constructs a new PhysicalNumberFormatter object. Overrides NumberFormatter:: |