src/Nodes/SVGNodeContainer.php
public function setChild($child, SVGNode $node)
    {
        $index = $this->resolveChildIndex($child);
        if ($index === false) {
            return $this;
        }

        $this->removeChild($index);
        $this->addChild($node, $index);

        return $this;
    }
public function setChild($child, SVGNode $node)
    {
        $index = $this->resolveChildIndex($child);
        if ($index === false) {
            return $this;
        }

        $this->removeChild($index);
        $this->addChild($node, $index);

        return $this;
    }
public function setChild ( $ child , SVGNode $ node ) { $ index = $ this -> resolveChildIndex ( $ child ) ; if ( $ index === false ) { return $ this ; } $ this -> removeChild ( $ index ) ; $ this -> addChild ( $ node , $ index ) ; return $ this ; }
Replaces a child node with another node.

@param SVGNode|int $child The node (or respective index) to replace.
@param SVGNode     $node  The replacement node.

@return $this This node instance, for call chaining.
Replaces a child node with another node .