58 $this->_eventManager = $eventManager;
59 $this->_localeResolver = $localeResolver;
60 $this->_currencyFactory = $currencyFactory;
76 \Magento\Framework\Profiler::start(
'locale/currency');
77 if (!isset(self::$_currencyCache[$this->_localeResolver->getLocale()][$currency])) {
80 $currencyObject = $this->_currencyFactory->create(
81 [
'options' => $currency,
'locale' => $this->_localeResolver->getLocale()]
83 }
catch (\Exception $e) {
84 $currencyObject = $this->_currencyFactory->create(
85 [
'options' => $this->
getDefaultCurrency(),
'locale' => $this->_localeResolver->getLocale()]
93 $this->_eventManager->dispatch(
94 'currency_display_options_forming',
95 [
'currency_options' =>
$options,
'base_code' => $currency]
98 $currencyObject->setFormat(
$options->toArray());
99 self::$_currencyCache[$this->_localeResolver->getLocale()][$currency] = $currencyObject;
101 \Magento\Framework\Profiler::stop(
'locale/currency');
102 return self::$_currencyCache[$this->_localeResolver->getLocale()][$currency];
const CURRENCY_OPTION_NAME
__construct(\Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\CurrencyFactory $currencyFactory)
const CURRENCY_OPTION_SYMBOL
const CURRENCY_OPTION_CURRENCY
const CURRENCY_OPTION_DISPLAY