Skip to content

Commit 78302c4

Browse files
author
Andrey Helldar
authored
Added $skip_empty option to appendChild method
1 parent eeedb10 commit 78302c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/Facades/Xml.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ public function makeItem(string $name, $value = null, array $attributes = []): D
7272
return $element;
7373
}
7474

75-
public function appendChild(DOMElement &$parent, DOMElement $child)
75+
public function appendChild(DOMElement &$parent, DOMElement $child, bool $skip_empty = true)
7676
{
77+
if ($skip_empty && !$child) {
78+
return;
79+
}
80+
7781
$node = $this->doc->importNode($child, true);
7882

7983
$parent->appendChild($node);

0 commit comments

Comments
 (0)