コード例 #1
0
ファイル: XmlGenerator.php プロジェクト: DavidHavl/Ajasta
 /**
  * @param XMLWriter $xmlWriter
  * @param Invoice   $invoice
  */
 protected function addDiscount(XMLWriter $xmlWriter, Invoice $invoice)
 {
     if ($invoice->getDiscount() === null) {
         return;
     }
     $xmlWriter->startElement('discount');
     $xmlWriter->writeElement('percentage', $this->percentageFormatter->format($invoice->getDiscount()));
     $xmlWriter->writeElement('amount', $this->currencyFormatter->formatCurrency($invoice->getDiscountAmount(), $invoice->getCurrencyCode()));
     $xmlWriter->writeElement('after', $this->currencyFormatter->formatCurrency($invoice->getDiscountAmount(), $invoice->getCurrencyCode()));
     $xmlWriter->endElement();
 }