Get details about a given ISO Currency.

@param string $code the three-letter currency code

@return array info about ISO Currency

@throws \InvalidArgumentException if currency code is unknown
425026
public static function getDetails($code)
    {
        $infos = self::getInfoForCurrencies();
        if (array_key_exists($code, $infos)) {
            return $infos[$code];
        }
        $infos = self::getInfoForCurrenciesWithoutCurrencyCode();
        if (array_key_exists($code, $infos)) {
            return $infos[$code];
        }
        $infos = self::getInfoForCurrenciesWithUnofficialCode();
        if (array_key_exists($code, $infos)) {
            return $infos[$code];
        }
        $infos = self::getInfoForCurrenciesWithHistoricalCode();
        if (array_key_exists($code, $infos)) {
            return $infos[$code];
        }
        throw new \InvalidArgumentException('Unknown \$code: ' . $code);
    }
934800
private function getCurrencyCode($currency)
    {
        $list = self::getCurrencyList();

        if (isset($list[$currency])) {
            return $list[$currency]['code'];
        }

        throw new \RuntimeException('Invalid exception provided');
    }
961610
public function getByIsoCode($sCode)
    {
        if (array_key_exists($sCode, $this->aSupportedCurrencies)) {
            return $this->aSupportedCurrencies[$sCode];
        } else {
            throw new CurrencyException('"' . $sCode . '" is not a valid currency code.');
        }
    }
655224
public static function get($code)
  {
    if (array_key_exists($code, self::$translations)) {
      return self::$translations[$code];
    }
    return sprintf('[%s]', $code);
  }
1099426
public function getIso($code = null)
    {
        $data = (array) gplcart_config_get(GC_FILE_CONFIG_COUNTRY);

        if (isset($code)) {
            return isset($data[$code]) ? $data[$code] : '';
        }

        return $data;
    }
1008462
public static function getISO4217CurrencyFromCode($code) {
    foreach (Connect2PayCurrencyHelper::$currencies as $currency => $data) {
      if ($data["code"] == $code) {
        return $currency;
      }
    }

    return null;
  }
571752
public function get($code)
    {
        $result = &gplcart_static("country.get.$code");

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('country.get.before', $code, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT * FROM country WHERE code=?';
        $result = $this->db->fetch($sql, array($code), array('unserialize' => 'format'));

        if (isset($result['format'])) {
            $default_format = $this->getDefaultFormat();
            $result['format'] = gplcart_array_merge($default_format, $result['format']);
            gplcart_array_sort($result['format']);
        }

        $this->hook->attach('country.get.after', $code, $result, $this);
        return $result;
    }
922700
public function findByCode($locale, $code)
    {
        $currency = $this->currencyRepository->findByCode($code);
        if (!$currency) {
            return null;
        }

        return new Currency($currency, $locale);
    }
568206
static public function getLabel($code)
    {
        static::isValid($code);

        switch ($code) {
            case static::EBP :
                return 'Euro Business Parcel';
            case static::GBP :
                return 'Global Business Parcel';
            case static::EP :
                return 'Express Parcel Guaranteed';
            case static::SHD :
                return 'Shop Delivery Service';
            case static::FDF :
                return 'Flex Delivery Service';
            case static::BP :
            default:
                return 'Business Parcel';
        }
    }
349116
public static function getCurrencyId($isoCode)
    {
        $allCurrencies = self::getAll();

        foreach ($allCurrencies as $currency) {
            if (strcasecmp($currency['abbreviation'], $isoCode) === 0) {
                return $currency['id'];
            }
        }
        throw new NotFound('Currency', $isoCode);
    }
75627
public function getCurrency($code = null)
    {
        $code = $code ?: $this->getUserCurrency();

        return Arr::get($this->getCurrencies(), strtoupper($code));
    }
661054
public function getLocaleByCode($code)
    {
        $locales = $this->getLocales();
        if (array_key_exists($code, $locales)) {
            return $locales[$code];
        }
    }
1057857
public function getCurrencyForCountry(string $countryCode) : Currency
    {
        $currencies = $this->getCurrenciesForCountry($countryCode);

        $count = count($currencies);

        if ($count === 1) {
            return $currencies[0];
        }

        if ($count === 0) {
            throw UnknownCurrencyException::noCurrencyForCountry($countryCode);
        }

        $currencyCodes = [];

        foreach ($currencies as $currency) {
            $currencyCodes[] = $currency->getCurrencyCode();
        }

        throw UnknownCurrencyException::noSingleCurrencyForCountry($countryCode, $currencyCodes);
    }
1287303
public function getCountryFromCode($code)
    {
        $code = strtoupper($code);
        $output = "Other";
        if (in_array($code, $this->countriesMapping)) {
            foreach ($this->countriesMapping as $country => $short) {
                if ($code == $short) {
                    $output = $country;
                    break;
                }
            }
        }

        return $output;
    }
453448
public function getIdByIso($isoCode) {
		$match = ['DE' => 1, 'AT' => 2, 'CH' => 3];

		$isoCode = strtoupper($isoCode);
		if (array_key_exists($isoCode, $match)) {
			return $match[$isoCode];
		}

		throw new InvalidArgumentException('ISO code not valid: ' . $isoCode);
	}
745340
protected function getCurrencyIso4217NumericCode($textCurrencyCode)
    {
        $currencies = null;

        $localIso417data = __DIR__ . DS . "Config" . DS . "iso4217.xml";

        $currencyXmlDataUrl = "http://www.currency-iso.org/dam/downloads/lists/list_one.xml";

        $xmlData = @file_get_contents($currencyXmlDataUrl);

        try {
            $currencies = new \SimpleXMLElement($xmlData);

            // Update the local currencies copy.
            @file_put_contents($localIso417data, $xmlData);
        } catch (\Exception $ex) {
            Tlog::getInstance()->warning("Failed to get currency XML data from $currencyXmlDataUrl: ".$ex->getMessage());
            try {
                $currencies = new \SimpleXMLElement(@file_get_contents($localIso417data));
            } catch (\Exception $ex) {
                Tlog::getInstance()->warning("Failed to get currency XML data from local copy $localIso417data: ".$ex->getMessage());
            }
        }

        if (null !== $currencies) {
            foreach ($currencies->CcyTbl->CcyNtry as $country) {
                if ($country->Ccy == $textCurrencyCode) {
                    return (string) $country->CcyNbr;
                }
            }
        }

        // Last chance
        switch ($textCurrencyCode) {
            case 'USD':
                return 840;
            case 'GBP':
                return 826;
                break;
            case 'EUR':
                return 978;
                break;
        }

        throw new \RuntimeException(
            Translator::getInstance()->trans(
                "Failed to get ISO 4217 data for currency %curr, payment is not possible.",
                ['%curr' => $textCurrencyCode]
            )
        );
    }
542141
public static function getByCode(string $code): ?Currency
    {
        $currencies = Currency::get();

        /** @var Currency $currency */
        $currency = $currencies->where("code", $code)->first();
        return $currency;
    }