/** * Private constructor. Use `getInstance()` to obtain the singleton instance. */ private function __construct() { $this->configurableCurrencyProvider = new ConfigurableCurrencyProvider(); $this->currencyProviderChain = new CurrencyProviderChain(); $this->currencyProviderChain->addCurrencyProvider(ISOCurrencyProvider::getInstance()); $this->currencyProviderChain->addCurrencyProvider($this->configurableCurrencyProvider); }
/** * @return CurrencyProviderChain */ private function createCurrencyProviderChain() { $providerChain = new CurrencyProviderChain(); $isoProvider = ISOCurrencyProvider::getInstance(); $provider = new ConfigurableCurrencyProvider(); $provider->addCurrency($isoProvider->getCurrency('EUR')); $provider->addCurrency($isoProvider->getCurrency('GBP')); $providerChain->addCurrencyProvider($provider); $provider = new ConfigurableCurrencyProvider(); $provider->addCurrency($isoProvider->getCurrency('USD')); $provider->addCurrency($isoProvider->getCurrency('CAD')); $providerChain->addCurrencyProvider($provider); return $providerChain; }