Definition at line 8 of file Currency.php.
◆ __construct()
- Parameters
-
\Magento\Framework\Event\ManagerInterface | $eventManager | |
ResolverInterface | $localeResolver | |
\Magento\Framework\CurrencyFactory | $currencyFactory | |
Definition at line 53 of file Currency.php.
58 $this->_eventManager = $eventManager;
59 $this->_localeResolver = $localeResolver;
60 $this->_currencyFactory = $currencyFactory;
◆ getCurrency()
Create Currency object for current locale
- Parameters
-
- Returns
- \Magento\Framework\Currency
Implements CurrencyInterface.
Definition at line 74 of file Currency.php.
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
const CURRENCY_OPTION_SYMBOL
const CURRENCY_OPTION_CURRENCY
◆ getDefaultCurrency()
◆ $_currencyCache
◆ $_currencyFactory
◆ $_eventManager
◆ $_localeResolver
◆ CURRENCY_OPTION_CURRENCY
const CURRENCY_OPTION_CURRENCY = 'currency' |
◆ CURRENCY_OPTION_DISPLAY
const CURRENCY_OPTION_DISPLAY = 'display' |
◆ CURRENCY_OPTION_NAME
const CURRENCY_OPTION_NAME = 'name' |
◆ CURRENCY_OPTION_SYMBOL
const CURRENCY_OPTION_SYMBOL = 'symbol' |
◆ DEFAULT_CURRENCY
const DEFAULT_CURRENCY = 'USD' |
The documentation for this class was generated from the following file: