Dumplie\SharedKernel\Domain\Money\Price::add PHP Метод

add() публичный Метод

public add ( Price $addend ) : Price
$addend Price
Результат Price
    public function add(Price $addend)
    {
        if (!$this->hasSameCurrency($addend)) {
            throw new InvalidCurrencyException($this->currency(), $addend->currency());
        }
        if ($this->precision !== $addend->precision) {
            throw new DifferentPricePrecisionException();
        }
        return new self($this->amount + $addend->amount, $this->currency(), $this->precision);
    }