Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getCurrency($currencyCode)
 {
     if (isset($this->currencies[$currencyCode])) {
         return $this->currencies[$currencyCode];
     }
     throw UnknownCurrencyException::unknownCurrency($currencyCode);
 }
Пример #2
0
 /**
  * {@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;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function getCurrency($currencyCode)
 {
     foreach ($this->providers as $provider) {
         try {
             return $provider->getCurrency($currencyCode);
         } catch (UnknownCurrencyException $e) {
             continue;
         }
     }
     throw UnknownCurrencyException::unknownCurrency($currencyCode);
 }