Tests if two objects are of equal value.

TODO: optionally supply a bank object to do a
currency conversion for an equals check?

@param Money $money
@return bool
512488
public function equals(Money $money)
    {
        if (!$money instanceof MultiCurrencyMoney) {
            return false;
        }

        return $money->currency == $this->currency && $money->getAmount() == $this->getAmount();
    }
1185946
public static function zero(Currency $currency = null)
    {
        if (null === $currency) {
            $currency = Currency::valueOf(Currency::NONE);
        }

        return self::valueOf('0', $currency);
    }
153133
public static void checkValid(Money value) {
    String currencyCode = value.getCurrencyCode();
    if (currencyCode == null || currencyCode.length() != 3) {
      throw new IllegalArgumentException(MSG_3_LETTERS_LONG);
    }
    long units = value.getUnits();
    int nanos = value.getNanos();
    if ((units > 0 && nanos < 0) || (units < 0 && nanos > 0)) {
      throw new IllegalArgumentException(MSG_UNITS_NANOS_MISMATCH);
    }
    if (Math.abs(nanos) > MAX_NANOS) {
      throw new IllegalArgumentException(MSG_NANOS_OOB);
    }
  }
1106205
public function isEqual(Money $a, Money $b) : bool
    {
        return $this->compare($a, $b) === 0;
    }
1063886
public function compare(Money $money)
    {
        return bccomp($this->amount, $money->getAmount(), self::BCSCALE);
    }
59729
public function equalsTo($value)
    {
        if (is_object($value) && $value instanceof Enum) {
            return $value->getValue() == $this->value;
        }
        return $value == $this->value;
    }
812569
public function equals(CurrencyPair $other)
    {
        return
            $this->baseCurrency->equals($other->baseCurrency)
            && $this->counterCurrency->equals($other->counterCurrency)
            && $this->conversionRatio === $other->conversionRatio
        ;
    }
1013241
public function isLessOrEqual(Money $a, Money $b) : bool
    {
        return $this->compare($a, $b) <= 0;
    }
760763
public function ceil(MoneyInterface $money, $precision = null)
    {
        if ($precision === null) {
            $precision = $this->informationProvider->getDefaultPrecision($money->getCurrency());
        }
        return $this->factory->create(
            $this->math->ceil($money->getAmount(), $precision),
            $money->getCurrency()
        );
    }
576868
public function compare(self $other)
    {
        $this->assertSameCurrency($other);

        if ($this->amount < $other->amount) {
            return -1;
        }

        if ($this->amount > $other->amount) {
            return 1;
        }

        return 0;
    }
415034
public function equals(Decimal $b, int $scale = null): bool
    {
        self::paramsValidation($b, $scale);

        if ($this === $b) {
            return true;
        } else {
            $cmp_scale = $scale !== null ? $scale : \max($this->scale, $b->scale);

            return (
                \bccomp(
                    self::innerRound($this->value, $cmp_scale),
                    self::innerRound($b->value, $cmp_scale),
                    $cmp_scale
                ) === 0
            );
        }
    }
709785
public function add(Money $money)
    {
        $this->assertSameCurrency($money);
        $amount = $this->amount->add($money->amount, $this->getInnerPrecision());

        return $this->newInstance($amount);
    }
606360
public static Predicate<MonetaryAmount> isCurrency(
			CurrencyUnit... currencies) {

		if (Objects.isNull(currencies) || currencies.length == 0) {
			return m -> true;
		}
		Predicate<MonetaryAmount> predicate = null;

		for (CurrencyUnit currencyUnit : currencies) {
			if (Objects.isNull(predicate)) {
				predicate = m -> m.getCurrency().equals(currencyUnit);
			} else {
				predicate = predicate.or(m -> m.getCurrency().equals(
						currencyUnit));
			}
		}
		return predicate;
    }
344174
func (m *Money) Equals(om *Money) (bool, error) {
	if err := m.assertSameCurrency(om); err != nil {
		return false, err
	}

	return m.compare(om) == 0, nil
}
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
        );
    }
1028109
public function is($currency) : bool
    {
        if ($currency instanceof Currency) {
            return $this->currencyCode === $currency->currencyCode;
        }

        return $this->currencyCode === (string) $currency
            || ($this->numericCode !== 0 && $this->numericCode === (int) $currency);
    }
508101
public function add(Money $money) : Money
    {
        $this->verifySameCurrency(__METHOD__, $money);

        return new Money($this->amount + $money->amount, $this->currency);
    }