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;
}