FOF30\Model\TreeModel::makeRoot PHP Method

makeRoot() public method

Makes the current node a root (and moving its entire subtree along the way). This is achieved by moving the node to the right of its root node
public makeRoot ( )
    public function makeRoot()
    {
        // Make sure we are not a root
        if ($this->isRoot()) {
            return $this;
        }
        // Get a reference to my root
        $myRoot = $this->getRoot();
        // Double check I am not a root
        if ($this->equals($myRoot)) {
            return $this;
        }
        // Move myself to the right of my root
        $this->moveToRightOf($myRoot);
        $this->treeDepth = 0;
        return $this;
    }