public function addItem(HasTax $item, int $amount = 1) : HasTax { $calculation = clone $this; $calculation->basePrice += $item->basePrice() * $amount; $calculation->taxPrice += $item->taxPrice() * $amount; return $calculation; }
public static function fromItem(HasTax $item) : Calculation { return new Calculation($item->basePrice(), $item->taxPrice()); }