src/Node/Node.php
public function setChildren(array $children): NodeInterface
    {
        foreach ($this->getChildren() as $node) {
            $this->removeChild($node->getId());
        }

        foreach ($children as $child) {
            $this->addChild($child);
        }

        return $this;
    }
public function setChildren(array $children): NodeInterface
    {
        foreach ($this->getChildren() as $node) {
            $this->removeChild($node->getId());
        }

        foreach ($children as $child) {
            $this->addChild($child);
        }

        return $this;
    }
public function setChildren ( array $ children ) : NodeInterface { foreach ( $ this -> getChildren ( ) as $ node ) { $ this -> removeChild ( $ node -> getId ( ) ) ; } foreach ( $ children as $ child ) { $ this -> addChild ( $ child ) ; } return $ this ; }
Sets the value of field children.

@param array $children - children.

@return NodeInterface
Sets the value of field children .