diff --git a/src/DomDocuments/ArticlesDocument.php b/src/DomDocuments/ArticlesDocument.php index bb184e03..ab84b784 100644 --- a/src/DomDocuments/ArticlesDocument.php +++ b/src/DomDocuments/ArticlesDocument.php @@ -85,7 +85,7 @@ public function addArticle(Article $article) if (is_bool($nodeValue)) { $nodeValue = ($nodeValue) ? 'true' : 'false'; } - $node = $this->createTextNode($nodeValue); + $node = $this->createTextNode($nodeValue ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -138,7 +138,7 @@ public function addArticle(Article $article) // Go through each line element and use the assigned method foreach ($lineTags as $tag => $method) { // Make the text node for the method value - $node = $this->createTextNode($line->$method()); + $node = $this->createTextNode($line->$method() ?? ''); // Make the actual element and assign the text node $element = $this->createElement($tag); diff --git a/src/DomDocuments/CustomersDocument.php b/src/DomDocuments/CustomersDocument.php index 84aa4c8e..83d46664 100644 --- a/src/DomDocuments/CustomersDocument.php +++ b/src/DomDocuments/CustomersDocument.php @@ -60,7 +60,7 @@ public function addCustomer(Customer $customer): void if($value = $customer->$method()) { // Make text node for method value - $node = $this->createTextNode($value); + $node = $this->createTextNode($value ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -96,7 +96,7 @@ public function addCustomer(Customer $customer): void if (is_bool($nodeValue)) { $nodeValue = ($nodeValue) ? 'true' : 'false'; } - $node = $this->createTextNode($nodeValue); + $node = $this->createTextNode($nodeValue ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -126,7 +126,7 @@ public function addCustomer(Customer $customer): void foreach ($collectMandateTags as $tag => $method) { // Make the text node for the method value - $node = $this->createTextNode($this->getValueFromCallback([$collectMandate, $method])); + $node = $this->createTextNode($this->getValueFromCallback([$collectMandate, $method]) ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -179,7 +179,7 @@ public function addCustomer(Customer $customer): void if (is_bool($nodeValue)) { $nodeValue = ($nodeValue) ? 'true' : 'false'; } - $node = $this->createTextNode($nodeValue); + $node = $this->createTextNode($nodeValue ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -231,7 +231,7 @@ public function addCustomer(Customer $customer): void foreach ($addressTags as $tag => $method) { // Make the text node for the method value - $node = $this->createTextNode($address->$method()); + $node = $this->createTextNode($address->$method() ?? ''); // Make the actual element and assign the text node $element = $this->createElement($tag); @@ -279,7 +279,7 @@ public function addCustomer(Customer $customer): void foreach ($bankTags as $tag => $method) { // Make the text node for the method value - $node = $this->createTextNode($bank->$method()); + $node = $this->createTextNode($bank->$method() ?? ''); // Make the actual element and assign the text node $element = $this->createElement($tag); @@ -292,8 +292,8 @@ public function addCustomer(Customer $customer): void // Bank address fields // Make the text nodes for the bank address fields - $field2Node = $this->createTextNode($bank->getAddressField2()); - $field3Node = $this->createTextNode($bank->getAddressField3()); + $field2Node = $this->createTextNode($bank->getAddressField2() ?? ''); + $field3Node = $this->createTextNode($bank->getAddressField3() ?? ''); // Make the actual elements and assign the text nodes $field2Element = $this->createElement('field2'); diff --git a/src/DomDocuments/InvoicesDocument.php b/src/DomDocuments/InvoicesDocument.php index bcd2b1de..c2a7e313 100644 --- a/src/DomDocuments/InvoicesDocument.php +++ b/src/DomDocuments/InvoicesDocument.php @@ -48,7 +48,7 @@ public function addInvoice(Invoice $invoice) $customer = $invoice->getCustomer(); // - $customerNode = $this->createTextNode($customer->getCode()); + $customerNode = $this->createTextNode($customer->getCode() ?? ''); $customerElement = $this->createElement('customer'); $customerElement->appendChild($customerNode); $headerElement->appendChild($customerElement); @@ -78,7 +78,7 @@ public function addInvoice(Invoice $invoice) if(null !== $value) { // Make text node for method value - $node = $this->createTextNode($value); + $node = $this->createTextNode($value ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -122,7 +122,7 @@ public function addInvoice(Invoice $invoice) foreach ($lineTags as $tag => $method) { // Make text node for method value - $node = $this->createTextNode($this->getValueFromCallback([$line, $method])); + $node = $this->createTextNode($this->getValueFromCallback([$line, $method]) ?? ''); if ($node->textContent === "") { continue; diff --git a/src/DomDocuments/SuppliersDocument.php b/src/DomDocuments/SuppliersDocument.php index 62436b6a..f5d8cda5 100644 --- a/src/DomDocuments/SuppliersDocument.php +++ b/src/DomDocuments/SuppliersDocument.php @@ -72,7 +72,7 @@ public function addSupplier(Supplier $supplier) foreach ($supplierTags as $tag => $method) { // Make text node for method value - $node = $this->createTextNode($supplier->$method()); + $node = $this->createTextNode($supplier->$method() ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -107,7 +107,7 @@ public function addSupplier(Supplier $supplier) if (is_bool($nodeValue)) { $nodeValue = ($nodeValue) ? 'true' : 'false'; } - $node = $this->createTextNode($nodeValue); + $node = $this->createTextNode($nodeValue ?? ''); // Make the actual element and assign the node $element = $this->createElement($tag); @@ -165,7 +165,7 @@ public function addSupplier(Supplier $supplier) foreach ($addressTags as $tag => $method) { // Make the text node for the method value - $node = $this->createTextNode($address->$method()); + $node = $this->createTextNode($address->$method() ?? ''); // Make the actual element and assign the text node $element = $this->createElement($tag); @@ -212,7 +212,7 @@ public function addSupplier(Supplier $supplier) foreach ($bankTags as $tag => $method) { // Make the text node for the method value - $node = $this->createTextNode($bank->$method()); + $node = $this->createTextNode($bank->$method() ?? ''); // Make the actual element and assign the text node $element = $this->createElement($tag); @@ -225,8 +225,8 @@ public function addSupplier(Supplier $supplier) // Bank address fields // Make the text nodes for the bank address fields - $field2Node = $this->createTextNode($bank->getAddressField2()); - $field3Node = $this->createTextNode($bank->getAddressField3()); + $field2Node = $this->createTextNode($bank->getAddressField2() ?? ''); + $field3Node = $this->createTextNode($bank->getAddressField3() ?? ''); // Make the actual elements and assign the text nodes $field2Element = $this->createElement('field2'); diff --git a/src/DomDocuments/TransactionsDocument.php b/src/DomDocuments/TransactionsDocument.php index a0e1c252..4aaf5da3 100644 --- a/src/DomDocuments/TransactionsDocument.php +++ b/src/DomDocuments/TransactionsDocument.php @@ -234,7 +234,7 @@ public function addTransaction(BaseTransaction $transaction) } if ($transactionLine->getDescription() !== null) { - $descriptionNode = $this->createTextNode($transactionLine->getDescription()); + $descriptionNode = $this->createTextNode($transactionLine->getDescription() ?? ''); $descriptionElement = $this->createElement('description'); $descriptionElement->appendChild($descriptionNode); $lineElement->appendChild($descriptionElement);