add() public method

Adds two Decimal objects
public add ( Decimal $b, integer $scale = null ) : Decimal
$b Decimal
$scale integer
return Decimal
Esempio n. 1
0
 /**
  * Returns a new Money object that represents
  * the sum of this and an other Money object
  *
  * @param Money $money
  * @return Money
  */
 public function add(Money $money)
 {
     $this->assertSameCurrency($money);
     $amount = $this->amount->add($money->amount, $this->getInnerPrecision());
     return $this->newInstance($amount);
 }