protected function _loop()
    {
        // Ensure that there are items on the stack
        if (!$this->_hasParents()) {
            return $this->_createIteration(null, null);
        }

        // Get current top item on the stack and its current iteration entry
        $parent  = &$this->_getCurrentIterable();
        $current = $this->_createCurrentIteration($parent);

        // Reached end of current iterable
        if ($current->getKey() === null) {
            return $this->_backtrackLoop();
        }

        // Element is a leaf
        if (!$this->_isElementHasChildren($current->getValue())) {
            next($parent);

            return $current;
        }

        // Element is not a leaf; push to stack
        $children = $current->getValue();
        $this->_pushParent($children);

        if ($this->_isMode(R::MODE_SELF_FIRST)) {
            return $current;
        }

        return $this->_loop();
    }
protected function _loop()
    {
        // Ensure that there are items on the stack
        if (!$this->_hasParents()) {
            return $this->_createIteration(null, null);
        }

        // Get current top item on the stack and its current iteration entry
        $parent  = &$this->_getCurrentIterable();
        $current = $this->_createCurrentIteration($parent);

        // Reached end of current iterable
        if ($current->getKey() === null) {
            return $this->_backtrackLoop();
        }

        // Element is a leaf
        if (!$this->_isElementHasChildren($current->getValue())) {
            next($parent);

            return $current;
        }

        // Element is not a leaf; push to stack
        $children = $current->getValue();
        $this->_pushParent($children);

        if ($this->_isMode(R::MODE_SELF_FIRST)) {
            return $current;
        }

        return $this->_loop();
    }
protected function _loop ( ) { // Ensure that there are items on the stack if ( ! $ this -> _hasParents ( ) ) { return $ this -> _createIteration ( null , null ) ; } // Get current top item on the stack and its current iteration entry $ parent = & $ this -> _getCurrentIterable ( ) ; $ current = $ this -> _createCurrentIteration ( $ parent ) ; // Reached end of current iterable if ( $ current -> getKey ( ) === null ) { return $ this -> _backtrackLoop ( ) ; } // Element is a leaf if ( ! $ this -> _isElementHasChildren ( $ current -> getValue ( ) ) ) { next ( $ parent ) ; return $ current ; } // Element is not a leaf; push to stack $ children = $ current -> getValue ( ) ; $ this -> _pushParent ( $ children ) ; if ( $ this -> _isMode ( R :: MODE_SELF_FIRST ) ) { return $ current ; } return $ this -> _loop ( ) ; }
Advances the iterator and computes the new state.

@since [*next-version*]

@return IterationInterface The iteration that represents the new state.
Advances the iterator and computes the new state .