lithium\data\collection\DocumentArray::next PHP Method

next() public method

Returns the next document in the set, and advances the object's internal pointer. If the end of the set is reached, a new document will be fetched from the data source connection handle ($_handle). If no more documents can be fetched, returns null.
public next ( ) : object | null
return object | null Returns the next document in the set, or `null`, if no more documents are available.
    public function next()
    {
        $prev = key($this->_data);
        $this->_valid = next($this->_data) !== false;
        $cur = key($this->_data);
        if (!$this->_valid && $cur !== $prev && $cur !== null) {
            $this->_valid = true;
        }
        return $this->_valid ? $this->offsetGet(key($this->_data)) : null;
    }