From 3c1543836e2cbc73fa87b8a51f44c9dd7ed47cb0 Mon Sep 17 00:00:00 2001 From: Rodrigo Butzke Date: Thu, 21 Aug 2025 17:17:38 -0300 Subject: [PATCH] SVGNodeContainer::addChildren(); --- src/Nodes/SVGNodeContainer.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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.