You are here

class NumberFormatterFactory in Price 8

Same name and namespace in other branches
  1. 3.x src/NumberFormatterFactory.php \Drupal\price\NumberFormatterFactory
  2. 3.0.x src/NumberFormatterFactory.php \Drupal\price\NumberFormatterFactory

Defines the NumberFormatter factory.

Hierarchy

Expanded class hierarchy of NumberFormatterFactory

Deprecated

Use \Drupal\price\CurrencyFormatter instead.

1 string reference to 'NumberFormatterFactory'
price.services.yml in ./price.services.yml
price.services.yml
1 service uses NumberFormatterFactory
price.number_formatter_factory in ./price.services.yml
Drupal\price\NumberFormatterFactory

File

src/NumberFormatterFactory.php, line 14

Namespace

Drupal\price
View source
class NumberFormatterFactory implements NumberFormatterFactoryInterface {

  /**
   * The currency formatter.
   *
   * @var \CommerceGuys\Intl\Formatter\CurrencyFormatterInterface
   */
  protected $currencyFormatter;

  /**
   * Constructs a new NumberFormatterFactory object.
   *
   * @param \CommerceGuys\Intl\Formatter\CurrencyFormatterInterface $currency_formatter
   *   The currency formatter.
   */
  public function __construct(CurrencyFormatterInterface $currency_formatter) {
    $this->currencyFormatter = $currency_formatter;
  }

  /**
   * {@inheritdoc}
   */
  public function createInstance() {
    return new LegacyNumberFormatter($this->currencyFormatter);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NumberFormatterFactory::$currencyFormatter protected property The currency formatter.
NumberFormatterFactory::createInstance public function Creates an instance of the number formatter for the current locale. Overrides NumberFormatterFactoryInterface::createInstance
NumberFormatterFactory::__construct public function Constructs a new NumberFormatterFactory object.