/** * @param XMLWriter $xmlWriter * @param Invoice $invoice */ protected function addVat(XMLWriter $xmlWriter, Invoice $invoice) { if ($invoice->getVat() === null) { return; } $xmlWriter->startElement('vat'); $xmlWriter->writeElement('percentage', $this->percentageFormatter->format($invoice->getVat())); $xmlWriter->writeElement('amount', $this->currencyFormatter->formatCurrency($invoice->getVatAmount(), $invoice->getCurrencyCode())); $xmlWriter->endElement(); }