@param float  $amount
@param string $currency

@return $this
542529
public function setPurchase($amount, $currency)
    {
        $this->data['purchase']['checkout']['amount'] = $amount;
        $this->data['purchase']['checkout']['currency'] = $currency;

        return $this;
    }
893711
public RoundedMoney with(Number amount) {
        checkNumber(amount);
        return new RoundedMoney(MoneyUtils.getBigDecimal(amount), currency, rounding);
    }
1071236
public function convert($amount, $from_currency, $to_currency)
    {
        if ($from_currency === $to_currency) {
            return $amount; // Nothing to convert
        }

        $currency = $this->get($from_currency);
        $target_currency = $this->get($to_currency);

        $exponent = $target_currency['decimals'] - $currency['decimals'];
        $amount *= pow(10, $exponent);

        return $amount * ($currency['conversion_rate'] / $target_currency['conversion_rate']);
    }
1206858
public function setCurrency(\BlackForest\PiwikBundle\Entity\PiwikCurrency $currency = null)
    {
        $this->currency = $currency;

        return $this;
    }
1019860
public static function amount($amount, $options = []) {
		$amount = trim($amount . '');
		// if currency code is passed we need to load symbol
		if (!empty($options['currency_code'])) {
			if (!isset(self::$cached_currencies)) {
				$temp = \Object\ACL\Resources::getStatic('currencies', 'primary');
				if (!empty($temp)) {
					self::$cached_currencies = $temp;
				} else {
					self::$cached_currencies = [];
				}
			}
			if (!isset($options['symbol']) || (isset($options['symbol']) && $options['symbol'] !== false)) {
				$options['symbol'] = self::$cached_currencies[$options['currency_code']]['symbol'] ?? null;
			}
			// override decimals only if not set
			if (!isset($options['decimals'])) {
				$options['decimals'] = self::$cached_currencies[$options['currency_code']]['fraction_digits'] ?? null;
			}
		}
		// decimals
		if (!isset($options['decimals'])) {
			$options['decimals'] = \Object\Data\Domains::getSetting('amount', 'scale');
		}
		// user defined monetary options
		if (empty($options['skip_user_settings'])) {
			// if type is not set then grab it from settings
			if (!empty($options['type'])) {
				$type = $options['type'];
			} else if (empty($options['fs'])) {
				$type = self::$options['format_amount_frm'];
			} else {
				$type = self::$options['format_amount_fs'];
			}
			if ($type == 10) { // Amount (Locale, With Currency Symbol)
				$options['symbol'] = $options['symbol'] ?? self::$options['locale_options']['currency_symbol'];
			} else if ($type == 20) { // Amount (Locale, Without Currency Symbol)
				$options['symbol'] = false;
			} else if ($type == 30) { // Accounting (Locale, With Currency Symbol)
				$options['symbol'] = $options['symbol'] ?? self::$options['locale_options']['currency_symbol'];
				$options['accounting'] = $options['accounting'] ?? true;
			} else if ($type == 40) { // Accounting (Locale, Without Currency Symbol)
				$options['symbol'] = false;
				$options['accounting'] = $options['accounting'] ?? true;
			} else if ($type == 99) { // Plain Amount
				$options['accounting'] = false;
				$options['symbol'] = false;
				$options['locale_options']['mon_thousands_sep'] = '';
			}
		}
		// formatting if we use locale
		if (self::useLocale()) {
			$amount = self::moneyFormat($amount, $options);
		} else { // if we are not using locale
			if (!empty($options['accounting']) && $amount < 0) {
				$amount = '(' . number_format(abs($amount), $options['decimals'], self::$options['locale_options']['mon_decimal_point'], self::$options['locale_options']['mon_thousands_sep']) . ')';
			} else {
				$amount = number_format($amount, $options['decimals'], self::$options['locale_options']['mon_decimal_point'], self::$options['locale_options']['mon_thousands_sep']);
			}
		}
		return $amount;
	}
1279483
public function setAmountMax(float $amountMax): self
    {
        $this->amountMax = (int) ($amountMax * self::FACTOR_AMOUNT_MAX);
        return $this;
    }
866095
public static function getStoreAmountOfCurrency($amount, $currencyCode) {
        $currencyCode   = strtoupper($currencyCode);
        $amount         = (int) $amount;

        if( in_array($currencyCode, self::FULL_VALUE_CURRENCIES, true) ) {
            return (float) $amount;
        }

        if( in_array($currencyCode, self::DIV_1000_VALUE_CURRENCIES, true) ) {
            return (float) ($amount / self::DIV_1000);
        }

        return (float) ($amount / self::DIV_100);
    }
209529
public function formatNumber($amount, array $currency)
    {
        $rounded = $this->round(abs($amount), $currency);
        return number_format($rounded, $currency['decimals'], $currency['decimal_separator'], $currency['thousands_separator']);
    }
1147586
public function limit($offset, $amount = null)
    {
        $this->queryBuilder->limit($offset, $amount);
        return $this;
    }
1171784
private function createMoney($amount, $currency) { $precision = isset($this->config[$currency]) ? $this->config[$currency]['precision'] : 2;
        return new Money($amount, new Currency($currency, $precision));
    }
295172
public function lighten($amount)
    {
        if ($amount < 0 || $amount > 100) {
            throw new InvalidArgumentException('The given amount must be between 0 and 100');
        }
        $amount /= 100;
        $this->lightness += (100 - $this->lightness) * $amount;

        return $this;
    }
459441
public function setCurrency($currency)
    {
      if(!is_string($currency) || strlen(trim($currency)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid currency, must be a non empty string');

      $this->currency = $currency;
    }
1099251
public function add(MoneyContainer $money) : MoneyBag
    {
        foreach ($money->getAmounts() as $currencyCode => $amount) {
            $this->amounts[$currencyCode] = $this->getAmount($currencyCode)->plus($amount);
        }

        return $this;
    }
661474
public function create($amount, $currency)
    {
        $result = new Money($amount, $currency);
        $this->validator->validateMoney($result);
        return $result;
    }
726496
public function add(MoneyInterface $money)
    {
        if ($this->currency !== $money->getCurrency()) {
            throw new CurrencyMismatchException('Operations between different currencies are not supported');
        }

        $this->amount = $this->toInt($this->amount + $money->getAmount());
        return $this;
    }
807581
protected function setCurrency($currency): void
    {
        if ( ! $currency instanceof Currency) {
            $currency = new Currency(strtoupper($currency));
        }

        $this->currency = $currency;
    }
273428
public function setPrice(MoneyInterface $amount)
    {
        $this->priceAmount = $amount->getAmount();
        $this->priceCurrency = $amount->getCurrency();

        return $this;
    }