Baum\Node::determineDepth PHP Method

determineDepth() protected method

Return an array with the last node we could reach and its nesting level.
protected determineDepth ( Baum\Node $node, integer $nesting ) : array
$node Baum\Node
$nesting integer
return array
    protected function determineDepth($node, $nesting = 0)
    {
        // Traverse back up the ancestry chain and add to the nesting level count
        while ($parent = $node->parent()->first()) {
            $nesting++;
            $node = $parent;
        }
        return [$node, $nesting];
    }