@param      $currency
@param null $allowedCurrencies

@throws \HpsInvalidRequestException
169925
public static function checkCurrency($currency, $allowedCurrencies = null)
    {
        $currencies = self::$_defaultAllowedCurrencies;
        if (isset($allowedCurrencies) && is_array($allowedCurrencies)) {
            $currencies = $allowedCurrencies;
        }

        if ($currency == null || $currency == '') {
            throw new HpsInvalidRequestException(
                HpsExceptionCodes::MISSING_CURRENCY,
                'Currency cannot be none',
                'currency'
            );
        } else if (!in_array(strtolower($currency), $currencies)) {
            throw new HpsInvalidRequestException(
                HpsExceptionCodes::INVALID_CURRENCY,
                "'".strtolower($currency)."' is not a supported currency",
                'currency'
            );
        }
    }
521586
protected function validateCurrency()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->currency->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Currency'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
888410
public static function currencies(string $currency = null) : Collection
    {
        $currency = strtoupper($currency);

        $file = __DIR__ . "/../Assets/Currencies.json";
        $json = json_decode(file_get_contents($file), true);

        if ($currency) {
            return Collection::make($json[$currency]);
        }

        return Collection::make($json);
    }
527651
protected function updateCurrencyRates(Currency $currency)
    {
        $baseExchangeRate = $this->table[$currency->getCode()];

        foreach ($this->table as $currencySymbol => $exchangeRate) {
            $rate = $this->calculateExchangeRate($baseExchangeRate, $currencySymbol);
            $this->addUpdateExchangeRate($currency->getCode(), $currencySymbol, $rate);
        }

        $this->helper->getEntityManager()->flush();
    }
1000865
public CreateCardChargeParams currency(final Currency currency) {
        return this.with("currency", currency == null ? Currency.MXN.name() : currency.name());
    }
1263282
public function setPayment(string $provider_token, string $currency = 'EUR')
    {
        if (!$provider_token) {
            $this->logger->warning('setPayment expects a valid provider token, an invalid one given.');
            throw new BotException('Invalid provider token given to "setPayment"');
        }

        $this->_provider_token = $provider_token;
        $this->_payment_currency = $currency;
    }
408775
public function setCurrency(\Sulu\Bundle\ProductBundle\Entity\Currency $currency = null)
    {
        $this->currency = $currency;

        return $this;
    }
823482
public function getCurrencyCode($currency = null)
    {
        if ($currency === null) {
            $currency = $this->_currency;
        }

        $code = KlarnaCurrency::getCode($currency);
        return (string) $code;
    }
346771
public function delete(CurrencyDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== ($currency = CurrencyQuery::create()->findPk($event->getCurrencyId()))) {
            if ($currency->getByDefault()) {
                throw new \RuntimeException(
                    Translator::getInstance()->trans('It is not allowed to delete the default currency')
                );
            }

            $currency
                ->setDispatcher($dispatcher)
                ->delete()
            ;

            $event->setCurrency($currency);
        }
    }
850137
public function setCurrency($country = null)
    {
        if (is_null($country)) {
            $country = config('currency.default');
        }
        $config = config('currency.' . $country);
        if (empty($config)) {
            throw new CurrencyNotAvaialbleException($country . ' currency not avaialble.');
        }
        $this->currency = $config;

        return $this;
    }
63574
public static function parseByIntlLocalizedDecimal(
        $money,
        $forceCurrency,
        $locale = null,
        Currencies $currencies = null,
        $style = NumberFormatter::DECIMAL
    ) {
        $numberFormatter = new NumberFormatter($locale ?: static::getLocale(), $style);
        $parser = new IntlLocalizedDecimalParser($numberFormatter, $currencies ?: static::getCurrencies());

        return self::parseByParser($parser, $money, $forceCurrency);
    }
654029
private function assertSameCurrency(Money $other)
    {
        if (!$this->isSameCurrency($other)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Cannot add Money with different currency. Have: %s, given: %s.',
                    $this->currency->getIsoCode(),
                    $other->getCurrency()->getIsoCode()
                )
            );
        }
    }
141838
public function setCurrency($currency) {

        $this->checkInArray($currency, GDAXConstants::$currencyValues);
        $this->currency = $currency;
        return $this;

    }
556740
protected function isValidCurrency(string $value): void
    {
        $allowedCurrency = $this->getAllowedCurrency();

        $regex = '/^' . implode('|', $allowedCurrency) . '$/';
        if (!preg_match($regex, $value)) {
            throw new InvalidCurrencyException(sprintf(
                '%s is not a valid currency. Currency must be in ISO-4217-3 format.',
                $value
            ));
        }
    }
308223
public CreateAlipayChargeParams currency(final Currency currency) {
        return this.with("currency", currency == null ? Currency.MXN.name() : currency.name());
    }
1185946
public static function zero(Currency $currency = null)
    {
        if (null === $currency) {
            $currency = Currency::valueOf(Currency::NONE);
        }

        return self::valueOf('0', $currency);
    }
30762
protected function currencyStringToNumeric($currency)
    {
        if (!in_array(strtolower($currency), array_keys(self::$currencyCodes))) {
            throw new HpsArgumentException(
                'Currency is not supported',
                HpsExceptionCodes::INVALID_CURRENCY
            );
        }
        return self::$currencyCodes[strtolower($currency)];
    }