Mongolid\Cursor\EmbeddedCursor::current PHP Method

current() public method

Iterator interface current. Return a model object with cursor document. (used in foreach).
public current ( ) : mixed
return mixed
    public function current()
    {
        if (!$this->valid()) {
            return;
        }
        $document = $this->items[$this->position];
        if ($document instanceof $this->entityClass) {
            return $document;
        }
        $schema = $this->getSchemaForEntity();
        $entityAssembler = Ioc::make(EntityAssembler::class, [$schema]);
        return $entityAssembler->assemble($document, $schema);
    }