Update currency in storage.

@param string $currency

@return void
542299
protected function update($currency)
    {
        if (($data = $this->getCurrency($currency)) === null) {
            return $this->error("Currency \"{$currency}\" not found");
        }

        $this->output->write("Updating {$currency} currency...");

        if (is_string($result = $this->storage->update($currency, $data))) {
            $this->output->writeln('<error>' . ($result ?: 'Failed') . '</error>');
        }
        else {
            $this->output->writeln("<info>success</info>");
        }
    }
1215817
private function updateFromGoogle($defaultCurrency)
    {
        $this->info('Updating currency exchange rates from finance.google.com...');
        foreach ($this->currency->getDriver()->all() as $code => $value) {
            // Don't update the default currency, the value is always 1
            if ($code === $defaultCurrency) {
                continue;
            }

            $response = $this->request('http://finance.google.com/finance/converter?a=1&from=' . $defaultCurrency . '&to=' . $code);

            if (Str::contains($response, 'bld>')) {
                $data = explode('bld>', $response);
                $rate = explode($code, $data[1])[0];
                
                $this->currency->getDriver()->update($code, [
                    'exchange_rate' => $rate,
                ]);
            }
            else {
                $this->warn('Can\'t update rate for ' . $code);
                continue;
            }
        }
    }
1053177
private void assignCurrencyPrivate(XAttributable element, String currency) {
		if (currency != null && currency.trim().length() > 0) {
			XAttributeLiteral attr = (XAttributeLiteral) ATTR_CURRENCY.clone();
			attr.setValue(currency);
			element.getAttributes().put(KEY_CURRENCY, attr);
		}
	}
999149
protected function updateCurrency(Money $money): self
    {
        if ($this->currency && $money->getCurrency()->getCode() !== $this->currency) {
            throw new CurrencyMismatchException('The currency on this stock movement is not the same as the one your Money object');
        }

        $this->currency = $money->getCurrency()->getCode();

        return $this;
    }
1243375
public function setCosts( $price )
	{
		if ( $price == $this->getCosts() ) { return; }

		$this->_checkPrice( $price );

		$this->_values['costs'] = $this->_formatNumber( $price );
		$this->setModified();
	}
921614
public function setPrice(Money $price): self
    {
        $this->updateCurrency($price);
        $this->price = (int) $price->getAmount();
        $this->updateTotalPrice();

        return $this;
    }
381739
private function setUserCurrency($currency, $request)
    {
        $currency = strtoupper($currency);

        // Set user selection globally
        currency()->setUserCurrency($currency);

        // Save it for later too!
        $request->getSession()->put(['currency' => $currency]);

        return $currency;
    }
914578
public function numericCodeFor(Currency $currency)
    {
        if (!$this->contains($currency)) {
            throw new UnknownCurrencyException('Cannot find ISO currency '.$currency->getCode());
        }

        return $this->getCurrencies()[$currency->getCode()]['numericCode'];
    }
514287
public function setValue($value)
    {
        $this->clearCachedValueIf($this->value != $value);
        $this->value = $value;
    }
746724
public function conversion(float $value = null, string $currency = null, int $transactionId = null): void
	{
		if ($this->config->adWordsConversionId) {
			$data = new ArrayHash;
			$data->value = $value;
			$data->currency = $currency;
			$data->transaction_id = $transactionId ?? '';

			$this->event('conversion',
				'AW-' . $this->config->adWordsConversionId . '/' . $this->config->adWordsConversionLabel,
				$data);
		}
	}
41279
protected function checkCurrencies($currencies)
    {
        foreach ((array) $currencies as $currency) {
            if (!$this->hasCurrency($currency)) {
                throw new InvalidCurrencyException(sprintf('"%s" is an unknown currency code.', $currency));
            }
        }
    }
141838
public function setCurrency($currency) {

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

    }
165315
private function retrieveExchangeRateFor(Currency $currency): void
    {
        $conversion = sprintf('%s_%s', $this->baseCurrency->getCode(), $currency->getCode());

        $response = $this->client->request('GET', self::EXCHANGE_RATE_API_URL . '/api/v6/convert', [
            'query' => ['q' => $conversion]
        ]);

        $data = json_decode($response->getBody(), true);

        if (! array_key_exists($conversion, $data['results'])) {
            throw CurrencyConverterApiException::currencyNotFound($currency->getCode());
        }

        $this->exchangeRates[$currency->getCode()] = (float) $data['results'][$conversion]['val'];
    }
1232605
public void deleteCurrency(Currency currency) {
        if (currencyList.containsKey(currency.getName())) {
            Common.getInstance().getStorageHandler().getStorageEngine().deleteCurrency(currency);
            currencyList.remove(currency.getName());
        }
    }
601745
public function setValue($value)
	{
		if ( $value == $this->getValue() ) {
			return;
		}

		$this->_values['value'] = (string) $value;

		$this->setModified();
	}
648472
public void setExchangeRate(Currency otherCurrency, double amount) {
        Common.getInstance().getStorageHandler().getStorageEngine().setExchangeRate(this, otherCurrency, amount);
    }
1299646
protected function delete($currency)
    {
        $this->output->write("Deleting {$currency} currency...");

        if (is_string($result = $this->storage->delete($currency))) {
            $this->output->writeln('<error>' . ($result ?: 'Failed') . '</error>');
        }
        else {
            $this->output->writeln("<info>success</info>");
        }
    }