WellCommerce\Bundle\CurrencyBundle\Formatter\CurrencyFormatter::format PHP Method

format() public method

public format ( $amount, $currency = null, $locale = null )
    public function format($amount, $currency = null, $locale = null)
    {
        if (null === $currency) {
            $currency = $this->requestHelper->getCurrentCurrency();
        }
        $locale = $this->getLocale($locale);
        $formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
        if (false === ($result = $formatter->formatCurrency($amount, $currency))) {
            throw new CurrencyFormatterException($amount, $currency, $locale);
        }
        return $result;
    }