diff --git a/src/Nodes/SVGNodeContainer.php b/src/Nodes/SVGNodeContainer.php index ee516bf..74933a7 100644 --- a/src/Nodes/SVGNodeContainer.php +++ b/src/Nodes/SVGNodeContainer.php @@ -28,16 +28,12 @@ public function __construct($name) * * @param SVGNode $node The node to add to this container's children. * - * @return bool Whether the action was valid and the child list changed. + * @return $this This node instance, for call chaining. */ public function addChild(SVGNode $node) { - if ($node === $this) { - return false; - } - - if ($node->parent === $this) { - return false; + if ($node === $this || $node->parent === $this) { + return $this; } if (isset($node->parent)) { @@ -47,7 +43,7 @@ public function addChild(SVGNode $node) $this->children[] = $node; $node->parent = $this; - return true; + return $this; } /** @@ -56,13 +52,13 @@ public function addChild(SVGNode $node) * * @param SVGNode|int $nodeOrIndex The node (or respective index) to remove. * - * @return bool Whether the action was valid and the child list changed. + * @return $this This node instance, for call chaining. */ public function removeChild($nodeOrIndex) { $index = $this->resolveChildIndex($nodeOrIndex); if ($index === false) { - return false; + return $this; } $node = $this->children[$index]; @@ -70,7 +66,7 @@ public function removeChild($nodeOrIndex) array_splice($this->children, $index, 1); - return true; + return $this; } /**