src/ISOCurrencyProvider.php
public function getCurrency($currencyCode) : Currency
    {
        if (isset($this->currencies[$currencyCode])) {
            return $this->currencies[$currencyCode];
        }

        if (! isset($this->currencyData[$currencyCode])) {
            if ($this->numericToCurrency === null) {
                $this->numericToCurrency = require __DIR__ . '/../data/numeric-to-currency.php';
            }

            if (isset($this->numericToCurrency[$currencyCode])) {
                return $this->getCurrency($this->numericToCurrency[$currencyCode]);
            }

            throw UnknownCurrencyException::unknownCurrency($currencyCode);
        }

        $currency = new Currency(... $this->currencyData[$currencyCode]);

        return $this->currencies[$currencyCode] = $currency;
    }
public function getCurrency($currencyCode) : Currency
    {
        if (isset($this->currencies[$currencyCode])) {
            return $this->currencies[$currencyCode];
        }

        if (! isset($this->currencyData[$currencyCode])) {
            if ($this->numericToCurrency === null) {
                $this->numericToCurrency = require __DIR__ . '/../data/numeric-to-currency.php';
            }

            if (isset($this->numericToCurrency[$currencyCode])) {
                return $this->getCurrency($this->numericToCurrency[$currencyCode]);
            }

            throw UnknownCurrencyException::unknownCurrency($currencyCode);
        }

        $currency = new Currency(... $this->currencyData[$currencyCode]);

        return $this->currencies[$currencyCode] = $currency;
    }
public function getCurrency ( $ currencyCode ) : Currency { if ( isset ( $ this -> currencies [ $ currencyCode ] ) ) { return $ this -> currencies [ $ currencyCode ] ; } if ( ! isset ( $ this -> currencyData [ $ currencyCode ] ) ) { if ( $ this -> numericToCurrency === null ) { $ this -> numericToCurrency = require __DIR__ . '/../data/numeric-to-currency.php' ; } if ( isset ( $ this -> numericToCurrency [ $ currencyCode ] ) ) { return $ this -> getCurrency ( $ this -> numericToCurrency [ $ currencyCode ] ) ; } throw UnknownCurrencyException :: unknownCurrency ( $ currencyCode ) ; } $ currency = new Currency ( ... $ this -> currencyData [ $ currencyCode ] ) ; return $ this -> currencies [ $ currencyCode ] = $ currency ; }
Returns the currency matching the given currency code.

@param string|int $currencyCode The 3-letter or numeric ISO 4217 currency code.

@return Currency The currency.

@throws UnknownCurrencyException If the currency code is not known.
Returns the currency matching the given currency code .