public function addLineItem(LineItem $lineItem) { if ($this->pricesIncludeVat === null) { $this->pricesIncludeVat = $lineItem->getPriceIncludesVat(); } else { if ($this->pricesIncludeVat !== $lineItem->getPriceIncludesVat()) { throw new \Exception("Lineitems in an invoice an either include VAT or not, but it must be the same for all items"); } } $this->lineItems[] = $lineItem; return $this; }