ElggBatch::next PHP Method

next() public method

public next ( )
    public function next()
    {
        // if we'll be at the end.
        if ($this->processedResults + 1 >= $this->limit && $this->limit > 0) {
            $this->results = array();
            return false;
        }
        // if we'll need new results.
        if ($this->resultIndex + 1 >= $this->chunkSize) {
            if (!$this->getNextResultsChunk()) {
                $this->results = array();
                return false;
            }
            $result = current($this->results);
        } else {
            // the function above resets the indexes, so only inc if not
            // getting new set
            $this->resultIndex++;
            $result = next($this->results);
        }
        $this->processedResults++;
        return $result;
    }