Returns a new WrappedMoney given a MoneyInterface.

@param MoneyInterface $money Money

@return WrappedMoney WrappedMoney new instance
517226
private function newWrappedMoneyFromMoney(MoneyInterface $money)
    {
        return new WrappedMoney(
            $money->getAmount(),
            new WrappedCurrency(
                $money
                    ->getCurrency()
                    ->getIso()
            )
        );
    }
476499
public function isEqual(MoneyInterface $first, MoneyInterface $second)
    {
        $this->resolveCurrency($first, $second);
        return $this->math->isEqual($first->getAmount(), $second->getAmount());
    }
789053
public function subtract(Money $money1, Money $money2)
    {
        $this->checkCurrenciesMatch($money1, $money2);

        return new Money(
            $money1->getAmount() - $money2->getAmount(),
            $money1->getCurrency()
        );
    }
697062
public function divide(
        Money $money,
        $fraction
    ): Money {
        return new Money(
            $money->getAmount() / $fraction,
            $money->getCurrency()
        );
    }
450418
public function setAbsolutePrice(MoneyInterface $amount)
    {
        $this->absolutePriceAmount = $amount->getAmount();
        $this->absolutePriceCurrency = $amount->getCurrency();

        return $this;
    }
909083
public function convert(Money $money, $roundingMode = Money::ROUND_HALF_UP)
    {
        if (!$money->getCurrency()->equals($this->baseCurrency)) {
            throw new InvalidArgumentException(
                sprintf('Currencies must match: Money to convert has currency %s, while CurrencyPair has base currency %s.',
                    $money->getCurrency()->getIsoCode(),
                    $this->baseCurrency->getIsoCode()
                )
            );
        }

        return new Money(
            Math::bcround(
                bcmul($money->getAmountString(), $this->ratio, Money::GAAP_PRECISION + 1),
                Money::GAAP_PRECISION,
                $roundingMode
            ),
            $this->counterCurrency
        );
    }
1123034
public function add(Money $addend)
    {
        $this->assertSameCurrency($addend);

        return new Money(bcadd($this->amount, $addend->getAmountString(), self::GAAP_PRECISION), $this->currency);
    }
423005
public function abs() : Money
    {
        return new Money($this->amount->abs(), $this->currency, $this->context);
    }
419173
public function exchange(Money $money, $targetCurrency)
    {
        if (is_string($targetCurrency)) {
            $targetCurrency = Currency::create($targetCurrency);
        }

        $exchangeRate = 0;
        return $money->exchange($targetCurrency, $exchangeRate);
    }
1030221
public function setAmount($value)
    {
        if ($value === null || $value === '') {
            $this->amount = new MonetaryAmount();
        } elseif (is_object($value) && $value instanceof AmountInterface) {
            $this->amount->setValue($value->getValue());
            $this->amount->setCurrency($value->getCurrency());
        } elseif (is_array($value)) {
            $this->amount->fromArray($value);
        } else {
            $this->amount->setValue($value);
        }

        return $this;
    }
226114
public function setReducedPrice(\Elcodi\Component\Currency\Entity\Interfaces\MoneyInterface $amount)
    {
        $this->reducedPrice = $amount->getAmount();
        $this->reducedPriceCurrency = $amount->getCurrency();

        return $this;
    }
724624
public function negated() : Money
    {
        return new Money($this->amount->negated(), $this->currency, $this->context);
    }
84908
public function asFloat(Money $money)
    {
        $amount = $money->getAmount();
        $amount = (float) $amount;
        $amount = $amount / pow(10, $this->decimals);

        return $amount;
    }
1304793
public function setShippingMethodFee(Money $money = null): OrderInterface
    {
        $this->shippingMethodFee = $money->getAmount();

        return $this;
    }
955166
public function negate(MoneyInterface $money)
    {
        if ($this->isZero($money)) {
            return $money;
        } else {
            return $this->mul($money, '-1');
        }
    }
499267
@Override
    protected RoundedMoney create(Number number, CurrencyUnit currency, MonetaryContext monetaryContext) {
        return RoundedMoney.of(number, currency, MonetaryContext.from(monetaryContext, RoundedMoney.class));
    }
1021208
public function setMinimumPurchase(MoneyInterface $amount)
    {
        $this->minimumPurchaseAmount = $amount->getAmount();
        $this->minimumPurchaseCurrency = $amount->getCurrency();

        return $this;
    }