Beispiel #1
0
 /**
  * @param XMLWriter $xmlWriter
  * @param Invoice   $invoice
  */
 protected function addGenericData(XMLWriter $xmlWriter, Invoice $invoice)
 {
     $xmlWriter->writeElement('address', implode("\n", $this->addressService->formatAddress($invoice->getClient()->getAddress())));
     $xmlWriter->writeElement('invoice-id', $invoice->getInvoiceNumber());
     $xmlWriter->writeElement('issue-date', $this->dateFormatter->format($invoice->getIssueDate()));
     if ($invoice->getDueDate() !== null) {
         $xmlWriter->writeElement('due-date', $this->dateFormatter->format($invoice->getDueDate()));
     }
 }
 /**
  * @covers ::formatAddress
  */
 public function testFormatAddressThrowsExceptionOnInvalidFormat()
 {
     $this->setExpectedException('RuntimeException', 'Unrecognized character "]" in format pattern "%]"');
     $address = new Address();
     $address->setCountryCode('FR');
     $addressService = new AddressService($this->options);
     $addressService->formatAddress($address);
 }
Beispiel #3
0
 /**
  * @param  Address $address
  * @return string
  */
 public function __invoke(Address $address)
 {
     return nl2br($this->getView()->escapeHtml(implode("\n", $this->addressService->formatAddress($address))));
 }