public function add(Decimal $b, $scale = null)
{
self::paramsValidation($b, $scale);
if ($b->isInfinite()) {
return $b;
}
return self::fromString(bcadd($this->value, $b->value, max($this->scale, $b->scale)), $scale);
}
/** * 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); }