src/BeeTree/Eloquent/ActAsEloquentNode.php
public function getLevel()
    {
        if ($this->_level !== null) {
            return $this->_level;
        }

        if ($this->isRoot()) {
            $this->_level = -1;
            return $this->_level;
        }

        $parents = array($this);
        $node = $this;

        while ($parent = $node->getParent()){
            if (!$parent->isRoot()) {
                $parents[] = $parent;
            }
            $node = $parent;
        }

        $this->_level = count($parents);

        return $this->_level;
    }
public function getLevel()
    {
        if ($this->_level !== null) {
            return $this->_level;
        }

        if ($this->isRoot()) {
            $this->_level = -1;
            return $this->_level;
        }

        $parents = array($this);
        $node = $this;

        while ($parent = $node->getParent()){
            if (!$parent->isRoot()) {
                $parents[] = $parent;
            }
            $node = $parent;
        }

        $this->_level = count($parents);

        return $this->_level;
    }
public function getLevel ( ) { if ( $ this -> _level !== null ) { return $ this -> _level ; } if ( $ this -> isRoot ( ) ) { $ this -> _level = - 1 ; return $ this -> _level ; } $ parents = array ( $ this ) ; $ node = $ this ; while ( $ parent = $ node -> getParent ( ) ) { if ( ! $ parent -> isRoot ( ) ) { $ parents [ ] = $ parent ; } $ node = $ parent ; } $ this -> _level = count ( $ parents ) ; return $ this -> _level ; }
Returns the level of this node

@return int
Returns the level of this node