Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow xml\builder#nest to take an array

  • Loading branch information...
commit d399134ecfeb810c3b2ea8007d058cffc9cd9f5c 1 parent b39c13e
@robacarp robacarp authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 Xml/Builder.php
View
14 Xml/Builder.php
@@ -112,11 +112,19 @@ public function nest($document){
$node = $this->last_node();
- if ($document instanceof DOMDocument)
+ if ($document instanceof DOMDocument) {
$kids = $document;
- elseif ($document instanceof static)
+
+ } elseif ($document instanceof static) {
$kids = $document->domdoc;
- else
+
+ } elseif (is_array( $document )) {
+ foreach ($document as $e)
+ $this->nest( $e );
+
+ return $this;
+
+ } else
throw new InvalidArgumentException(' nest only knows how to import children from a DOMDocument or a SparkLib\Xml\Builder.');
if (count($kids) == 0)
Please sign in to comment.
Something went wrong with that request. Please try again.