You are here

public function LegacyNumberFormatter::parseCurrency in Commerce Core 8.2

Parses a formatted currency amount.

Parameters

string $number: The formatted number.

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

Return value

string|false The parsed currency amount, or FALSE on failure.

File

modules/price/src/LegacyNumberFormatter.php, line 92

Class

LegacyNumberFormatter
Provides a legacy number formatter for the deprecated NumberFormatterFactory.

Namespace

Drupal\commerce_price

Code

public function parseCurrency($number, CurrencyInterface $currency) {
  return $this->currencyFormatter
    ->parse($number, $currency
    ->id());
}