library/Money/MoneyTrait.php
public function compareTo(MoneyInterface $money)
    {
        if ($this->currency !== $money->getCurrency()) {
            throw new CurrencyMismatchException('Operations between different currencies are not supported.');
        }

        if ($this->amount == $money->getAmount()) {
            return 0;
        }

        return $this->amount < $money->getAmount() ? -1 : 1;
    }
public function compareTo(MoneyInterface $money)
    {
        if ($this->currency !== $money->getCurrency()) {
            throw new CurrencyMismatchException('Operations between different currencies are not supported.');
        }

        if ($this->amount == $money->getAmount()) {
            return 0;
        }

        return $this->amount < $money->getAmount() ? -1 : 1;
    }
public function compareTo ( MoneyInterface $ money ) { if ( $ this -> currency !== $ money -> getCurrency ( ) ) { throw new CurrencyMismatchException ( 'Operations between different currencies are not supported.' ) ; } if ( $ this -> amount == $ money -> getAmount ( ) ) { return 0 ; } return $ this -> amount < $ money -> getAmount ( ) ? - 1 : 1 ; }
Compares this object with another

Returns an integer less than, equal to, or greater than zero
if the value of this MoneyInterface object is considered to be respectively
less than, equal to, or greater than the other MoneyInterface object.

@param MoneyInterface $money
@throws InvalidArgumentException
@return int
Compares this object with another