Actually returns a Traversable object with the DriverCursor within.
If it does not exists yet, create it using the $collection, $command and
$params given.

@return Traversable
420511
protected function getCursor(): Traversable
    {
        if (!$this->cursor) {
            $driverCursor = $this->collection->{$this->command}(...$this->params);
            $this->cursor = new IteratorIterator($driverCursor);
            $this->cursor->rewind();
        }

        return $this->cursor;
    }
1177986
private function traverseObject($obj, $keys)
    {
        if (empty($keys)) {
            return $obj;
        }
        $key = current($keys);

        if (is_array($obj) && isset($obj[$key])) {
            return $this->traverseObject($obj[$key], array_slice($keys, 1));
        } else if (is_object($obj) && isset($obj->{$key})) {
            return $this->traverseObject($obj->{$key}, array_slice($keys, 1));
        } else {
            return null;
        }
    }
1056417
public function getAvailableDictionaries(): \Traversable
    {
        foreach ($this->dictionaries as $name => $dictionary) {
            yield $this->createInformation($name, $dictionary);
        }
    }
159917
private function traversable(iterable $traversable)
    {
        if ($traversable instanceof \IteratorAggregate) {
            return $this->traversable($traversable->getIterator());
        }

        return $traversable;
    }
1037567
public function getDriver()
    {
        if (null != $this->driver) {
            return $this->driver;
        }

        switch($this->config['driver']) {
            case "file":
                $this->driver   = $this->createFileDriver();
                break;
            case "memcached":
                $this->driver   = $this->createMemcacheDriver();
                break;
            case "redis":
                $this->driver   = $this->createRedisDriver();
                break;
            default:
                throw new SessionException("Driver [{$this->config['driver']}] not supported.");
        }

        return $this->driver;
    }
411927
protected function createDatabaseDriver()
	{
		$connection = $this->getDatabaseConnection();

		$table = $connection->getTablePrefix().$this->app['config']['session.table'];

		return $this->buildSession(new PdoSessionHandler($connection->getPdo(), $this->getDatabaseOptions($table)));
	}
405177
protected function getConnectionFromDriverManager()
    {
        $configuration = new Configuration();
        $connectionParameters = $this->getConnectionParameters();

        return DriverManager::getConnection($connectionParameters, $configuration);
    }
561185
public function getTraverser()
    {
        if (!$this->traverser) {
            $this->traverser = new NodeTraverser;
            $this->traverser->addVisitor(new NameResolver);
            $this->traverser->addVisitor($this->getVisitor());
        }

        return $this->traverser;
    }
795074
public function getIterator()
    {
        foreach ($this->rawIterator() as $data) {
            $this->data = $this->persistence->typecastLoadRow($this, $data);
            if ($this->id_field) {
                $this->id = isset($data[$this->id_field]) ? $data[$this->id_field] : null;
            }

            // you can return false in afterLoad hook to prevent to yield this data row
            // use it like this:
            // $model->addHook('afterLoad', function ($m) {
            //     if ($m['date'] < $m->date_from) $m->breakHook(false);
            // })

            // you can also use breakHook() with specific object which will then be returned
            // as a next iterator value

            $ret = $this->hook('afterLoad');

            if ($ret === false) {
                continue;
            }

            if (is_object($ret)) {
                if ($ret->id_field) {
                    yield $ret->id => $ret;
                } else {
                    yield $ret;
                }
            } else {
                if ($this->id_field) {
                    yield $this->id => $this;
                } else {
                    yield $this;
                }
            }
        }

        $this->unload();
    }
910896
protected function createSesDriver()
	{
		$config = Config::get( 'services.ses' );

		$config += [
			'version' => 'latest',
			'service' => 'email',
		];

		if ( $config['key'] && $config['secret'] )
		{
			$config['credentials'] = Arr::only( $config, ['key', 'secret'] );
		}

		return new SesTransport( new SesClient( $config ) );
	}
1373272
public function cursor()
    {
        foreach ($this->applyScopes()->query->cursor() as $record) {
            yield $this->model->newFromBuilder($record);
        }
    }
486220
public function traverse()
    {
        // If the recursive flag is passed, traverse recursively.
        if ($this->recursive) {
            $objects = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator($this->path), \RecursiveIteratorIterator::SELF_FIRST
            );
            foreach ($objects as $fileInfo) {
                if (($fileInfo->getFilename() != '.') && ($fileInfo->getFilename() != '..')) {
                    $this->objects[] = $fileInfo;
                    // If absolute path flag was passed, store the absolute path.
                    if ($this->absolute) {
                        $f = null;
                        if (!$this->filesOnly) {
                            $f = ($fileInfo->isDir()) ? (realpath($fileInfo->getPathname())) : realpath($fileInfo->getPathname());
                        } else if (!$fileInfo->isDir()) {
                            $f = realpath($fileInfo->getPathname());
                        }
                        if (($f !== false) && (null !== $f)) {
                            $this->files[] = $f;
                        }
                    // If relative path flag was passed, store the relative path.
                    } else if ($this->relative) {
                        $f = null;
                        if (!$this->filesOnly) {
                            $f = ($fileInfo->isDir()) ? (realpath($fileInfo->getPathname())) : realpath($fileInfo->getPathname());
                        } else if (!$fileInfo->isDir()) {
                            $f = realpath($fileInfo->getPathname());
                        }
                        if (($f !== false) && (null !== $f)) {
                            $this->files[] = substr($f, (strlen(realpath($this->path)) + 1));
                        }
                    // Else, store only the directory or file name.
                    } else {
                        if (!$this->filesOnly) {
                            $this->files[] = ($fileInfo->isDir()) ? ($fileInfo->getFilename()) : $fileInfo->getFilename();
                        } else if (!$fileInfo->isDir()) {
                            $this->files[] = $fileInfo->getFilename();
                        }
                    }
                }
            }
            // Else, only traverse the single directory that was passed.
        } else {
            foreach (new \DirectoryIterator($this->path) as $fileInfo) {
                if(!$fileInfo->isDot()) {
                    $this->objects[] = $fileInfo;
                    // If absolute path flag was passed, store the absolute path.
                    if ($this->absolute) {
                        $f = null;
                        if (!$this->filesOnly) {
                            $f = ($fileInfo->isDir()) ?
                                ($this->path . DIRECTORY_SEPARATOR . $fileInfo->getFilename() . DIRECTORY_SEPARATOR) :
                                ($this->path . DIRECTORY_SEPARATOR . $fileInfo->getFilename());
                        } else if (!$fileInfo->isDir()) {
                            $f = $this->path . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
                        }
                        if (($f !== false) && (null !== $f)) {
                            $this->files[] = $f;
                        }
                    // If relative path flag was passed, store the relative path.
                    } else if ($this->relative) {
                        $f = null;
                        if (!$this->filesOnly) {
                            $f = ($fileInfo->isDir()) ?
                                ($this->path . DIRECTORY_SEPARATOR . $fileInfo->getFilename() . DIRECTORY_SEPARATOR) :
                                ($this->path . DIRECTORY_SEPARATOR . $fileInfo->getFilename());
                        } else if (!$fileInfo->isDir()) {
                            $f = $this->path . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
                        }
                        if (($f !== false) && (null !== $f)) {
                            $this->files[] = substr($f, (strlen(realpath($this->path)) + 1));
                        }
                    // Else, store only the directory or file name.
                    } else {
                        if (!$this->filesOnly) {
                            $this->files[] = ($fileInfo->isDir()) ? ($fileInfo->getFilename()) : $fileInfo->getFilename();
                        } else if (!$fileInfo->isDir()) {
                            $this->files[] = $fileInfo->getFilename();
                        }
                    }
                }
            }
        }
    }
710127
protected function createDriver($driverName)
    {
        [$driver, $name] = $this->getDriverName($driverName);

        $method = 'create'.Str::studly($driver).'Driver';

        // We'll check to see if a creator method exists for the given driver.
        // If not we will check for a custom driver creator, which allows
        // developers to create drivers using their own customized driver
        // creator Closure to create it.
        if (isset($this->customCreators[$driver])) {
            return $this->callCustomCreator($driverName);
        } elseif (\method_exists($this, $method)) {
            return $this->{$method}($name);
        }

        throw new InvalidArgumentException("Driver [$driver] not supported.");
    }
1012589
public function create(): Driver
    {
        if ($driver = $this->createDriverFromEnv()) {
            return $driver;
        }

        if (UvDriver::isSupported()) {
            return new UvDriver;
        }

        if (EvDriver::isSupported()) {
            return new EvDriver;
        }

        if (EventDriver::isSupported()) {
            return new EventDriver;
        }

        return new NativeDriver;
    }
403903
public function getIterator() {
        $ret = array(
            'id'           => $this->id,
            'contextlevel' => $this->contextlevel,
            'instanceid'   => $this->instanceid,
            'path'         => $this->path,
            'depth'        => $this->depth,
            'locked'       => $this->locked,
        );
        return new ArrayIterator($ret);
    }
600255
public static function createFromObject(\Traversable $object): self
    {
        // init
        $array = new static();

        if ($object instanceof self) {
            $objectArray = $object->getGenerator();
        } else {
            $objectArray = $object;
        }

        foreach ($objectArray as $key => $value) {
            $array[$key] = $value;
        }

        return $array;
    }
450544
public function traversable()
    {
        $message   = ['%s is {{not|}} traversable', $this->value];
        $assertion = (is_array($this->value) || $this->value instanceof Traversable);
        $this->assert($assertion, $message);

        return $this;
    }