protected function inTree(NodeInterface $node1, NodeInterface $node2)
    {
        if($node1 == $node2) {
            return true;
        } elseif(!is_null($parent = $node1->getParent())) {
            return $this->inTree($parent, $node2);
        }

        return false;
    }
protected function inTree(NodeInterface $node1, NodeInterface $node2)
    {
        if($node1 == $node2) {
            return true;
        } elseif(!is_null($parent = $node1->getParent())) {
            return $this->inTree($parent, $node2);
        }

        return false;
    }
protected function inTree ( NodeInterface $ node1 , NodeInterface $ node2 ) { if ( $ node1 == $ node2 ) { return true ; } elseif ( ! is_null ( $ parent = $ node1 -> getParent ( ) ) ) { return $ this -> inTree ( $ parent , $ node2 ) ; } return false ; }
check the node tree for recursion

@param NodeInterface $node1
@param NodeInterface $node2
@return bool
check the node tree for recursion