Money\Money::isNegative PHP Method

isNegative() public method

Checks if the value represented by this object is negative
public isNegative ( ) : boolean
return boolean
    public function isNegative()
    {
        return $this->compareTo0() === -1;
    }

Usage Example

Example #1
0
 /**
  * Deposit the given amount to the beneficiary's account
  *
  * @param Money $amount
  * @throws InvalidTransferAmount
  *     A member cannot transfer a negative amount to another member
  */
 protected function applyDeposit(Money $amount)
 {
     if ($amount->isNegative()) {
         throw new InvalidTransferAmount("Cannot transfer negative amount {$amount->getAmount()}");
     }
     $this->account->deposit($amount);
 }