You are here

public function LegacyNumberFormatter::formatCurrency in Price 3.x

Same name and namespace in other branches
  1. 8 src/LegacyNumberFormatter.php \Drupal\price\LegacyNumberFormatter::formatCurrency()
  2. 3.0.x src/LegacyNumberFormatter.php \Drupal\price\LegacyNumberFormatter::formatCurrency()

Formats a currency amount.

Parameters

string $number: The number.

\Drupal\price\Entity\CurrencyInterface $currency: The currency.

Return value

string The formatted currency amount.

File

src/LegacyNumberFormatter.php, line 64

Class

LegacyNumberFormatter
Provides a legacy number formatter for the deprecated NumberFormatterFactory.

Namespace

Drupal\price

Code

public function formatCurrency($number, CurrencyInterface $currency) {
  return $this->currencyFormatter
    ->format($number, $currency
    ->id(), $this->options);
}