Iterator interface current. Return a model object
with cursor document. (used in foreach).

@return mixed
6279
public function current()
    {
        $document = $this->getCursor()->current();

        if ($document instanceof ActiveRecord) {
            $documentToArray = $document->toArray();
            $this->entitySchema = $document->getSchema();
        } else {
            $documentToArray = (array) $document;
        }

        return $this->getAssembler()->assemble(
            $documentToArray,
            $this->entitySchema
        );
    }
251175
private function getCurrentItem()
    {
        // Hack for weird initialization logic
        if (!$this->currentItem) {
            $key = $this->getCurrentKey();
            $this->currentItem = $this->getItemStorage()->get($key);
        }

        return $this->currentItem;
    }
81256
public function current()
    {
        if (isset($this->buffer[$this->position])) {
            return $this->buffer[$this->position];
        }
        $this->ensurePosition();
        $data = $this->resultSet->current();
        $this->buffer[$this->position] = $data;
        return $data;
    }
678496
public function getIterator() {
        $ret = array('id' => $this->record->id);
        foreach ($this->record as $property => $value) {
            $ret[$property] = $value;
        }
        return new ArrayIterator($ret);
    }
936104
public function current()
    {
        $data = $this->dataSource->current();
        $object = null;

        if (is_array($data)) {
            $object = $this->getPrototypeStrategy()->createObject($this->getObjectPrototype(), $data);
            $this->getHydrator()->hydrate($data, $object);
        }

        return $object;
    }
1373272
public function cursor()
    {
        foreach ($this->applyScopes()->query->cursor() as $record) {
            yield $this->model->newFromBuilder($record);
        }
    }
262303
public function getIterator()
    {
        if (is_null($i = $this->model ?: $this->dq ?: $this->iter)) {
            throw $this->exception('Please specify data source with setSource or setModel');
        }
        if ($i instanceof Closure) {
            $i = call_user_func($i);
        }

        return $i;
    }
470198
public function current()
    {
        return isset($this->mappedEnums[$this->iteratorIndex])
            ? $this->valueMap[$this->mappedEnums[$this->iteratorIndex]->getConstName()]
            : null;
    }
74882
public function getIterator()
    {
        $iter = parent::getIterator();

        // sorting support
        if ($this->sortby) {
            $desc = ($this->sortby_db[0] == '-');
            $order = ltrim($this->sortby_db, '-');
            $this->applySorting($iter, $order, $desc);
        }

        return $iter;
    }
503167
public function current()
    {
        if (false !== $this->value) {
            return $this->value;
        }

        $this->value = $this->getCurrentRecord();

        return $this->value;
    }
491862
public function current()
    {
        if ($this->buffer === null) {
            $this->buffer = -2; // implicitly disable buffering from here on
        } elseif (is_array($this->buffer) && isset($this->buffer[$this->position])) {
            return $this->buffer[$this->position];
        }
        $data = $this->dataSource->current();
        
        if (is_array($this->buffer)) {
            $this->buffer[$this->position] = $data;
        }
        
        if ($this->returnType === self::TYPE_ARRAYOBJECT && is_array($data)) {
            $ao = clone $this->arrayObjectPrototype;
            if ($ao instanceof ArrayObject || method_exists($ao, 'exchangeArray')) {
                if ($ao instanceof AbstractModel) {
                    if(null === $this->array_prefix) {
                        $tab = [];
                        foreach ($data as $k => $v){
                            if(strpos($k, '$')!==false) {
                                $tab[] = explode('$', $k)[0];
                            }
                        }
                        $this->array_prefix = array_unique($tab);
                    }
                    $ao->setArrayPrefix($this->array_prefix);
                }
                $ao->exchangeArray($data);
            }
            $data = $ao;
        }
            
        if ($this->bufferArrayObjectPrototype && $this->buffer[$this->position] !== $data) {
            $this->buffer[$this->position] = $data;
        }

        return $data;
    }
826190
protected function get_iterator() {
        global $DB;

        // Build the SQL dynamically here
        $fieldslist = 't.' . implode(', t.', $this->fields);
        $sql = "SELECT t.id, $fieldslist
                  FROM {" . $this->tablename . "} t
                  JOIN {backup_ids_temp} b ON b.newitemid = t.id
                 WHERE b.backupid = ?
                   AND b.itemname = ?
                   AND t.blockname = 'html'";
        $params = array($this->restoreid, $this->mapping);
        return ($DB->get_recordset_sql($sql, $params));
    }
397229
public function current()
	{
		$fact = parent::current();
		if ( $fact )
		{
			if ( ! $this->uncoveredAspectFacts )
			{
				$coveredFact = $fact;

				if ( $this->var->bindAsSequence )
				{
					if ( $coveredFact instanceof XPath2NodeIterator )
					{
						// Get the first item
						$coveredFact->rewind();
						$coveredFact = $coveredFact->current();  // Should be DOMXPathNavigator
					}
				}

				$this->uncoveredAspectFacts = array_fill_keys( $this->aspectsDefined, $coveredFact );
				$this->uncoveredAspectFacts = array_merge( $this->uncoveredAspectFacts, array_fill_keys( $this->aspectsCovered, null ) );
			}
		}

		return $fact;
	}
452150
protected function getPrev()
    {
        if (!$this->current)
        {
            return null;
        }
        if ($this->prev !== -1)
        {
            return $this->prev;
        }
        $this->load();
        for ($i = 0; $i < count($this->items); $i++)
        {
            if ($this->items[$i]->id == $this->current->id)
            {
                if ($i > 0)
                {
                    $this->prev = $this->items[$i - 1];
                    return $this->prev;
                }
                break;
            }
        }
        return null;
    }
9393
public function get()
    {
        $m = $this->model;
        if (!$m) {
            throw $this->exception('Specify model_class or define your method handlers');
        }

        if ($m->loaded()) {
            if (!$this->allow_list_one) {
                throw $this->exception('Loading is not allowed');
            }

            return $this->outputOne($m->get());
        }

        if (!$this->allow_list) {
            throw $this->app->exception('Listing is not allowed');
        }

        return $this->outputMany($m->setLimit(100)->getRows());
    }
860579
public function getEndCursor()
    {
        if(isset($this->obj_last_response->batch) && isset($this->obj_last_response->batch->endCursor)) {
            return $this->obj_last_response->batch->endCursor;
        }
        return null;
    }
161888
public function cursor()
    {
        if (is_null($this->columns)) {
            $this->columns = ['*'];
        }

        return $this->connection->cursor(
            $this->toSql(), $this->getBindings(), ! $this->useWritePdo
        );
    }