/** * {@inheritdoc} */ public function getCurrency($currencyCode) { if (isset($this->currencies[$currencyCode])) { return $this->currencies[$currencyCode]; } throw UnknownCurrencyException::unknownCurrency($currencyCode); }
/** * {@inheritdoc} */ public function getCurrency($currencyCode) { if (isset($this->currencies[$currencyCode])) { return $this->currencies[$currencyCode]; } if (!isset($this->currencyData[$currencyCode])) { throw UnknownCurrencyException::unknownCurrency($currencyCode); } $currency = Currency::create(...$this->currencyData[$currencyCode]); return $this->currencies[$currencyCode] = $currency; }
/** * {@inheritdoc} */ public function getCurrency($currencyCode) { foreach ($this->providers as $provider) { try { return $provider->getCurrency($currencyCode); } catch (UnknownCurrencyException $e) { continue; } } throw UnknownCurrencyException::unknownCurrency($currencyCode); }