diff --git a/src/Nodes/SVGNodeContainer.php b/src/Nodes/SVGNodeContainer.php index af72bc8..4fb25c4 100644 --- a/src/Nodes/SVGNodeContainer.php +++ b/src/Nodes/SVGNodeContainer.php @@ -31,6 +31,21 @@ public function __construct() $this->children = []; } + /** + * Inserts multiple SVGNodes at same time + * + * @see SVGNodeContainer::addChild(); + * + * @return $this This node instance, for call chaining. + */ + public function addChildren(array $nodes, ?array $indexes = null): SVGNodeContainer + { + foreach ($nodes as $k=> $node) { + $this->addChild($node, $indexes[$k] ?? null); + } + return $this; + } + /** * Inserts an SVGNode instance at the given index, or, if no index is given, * at the end of the child list.