Get a driver instance.

@param  string  $driver
@return mixed
513152
public function driver($driver = null)
    {
        $driver = $driver ?: $this->getDefaultDriver();

        if (! isset($this->drivers[$driver])) {
            $this->drivers[$driver] = $this->createDriver($driver);
        }

        return $this->drivers[$driver];
    }
960972
public function getDriver($alias)
    {
        try {
            if ($alias == "Auth") {
                $driver = \Auth::driver();
            } elseif ($alias == "DB") {
                $driver = \DB::connection();
            } elseif ($alias == "Cache") {
                $driver = get_class(\Cache::driver());
                $store = get_class(\Cache::getStore());
                return array($driver, $store);
            } elseif ($alias == "Queue") {
                $driver = \Queue::connection();
            } else {
                return false;
            }

            return get_class($driver);
        } catch (\Exception $e) {
            $this->error("Could not determine driver/connection for $alias.");
            return false;
        }
    }
511724
public function getView(Driver $driver)
    {
        $this->view->setParam('errors', false);
        $this->view->setParam('message', 'ok');

        if (false === $this->crudOperationHandler->remove($driver, $this->model)) {
            $this->view->setParam('errors', true);
            $this->view->setParam('message', $this->translator->trans($this->crudOperationHandler->getErrorMessage(), array(), $this->translationDomain));
        }

        return $this->view;
    }
40316
protected function setupDriverConfig(string $driver): ?array
    {
        if (isset($this->config[$driver])) {
            return null;
        }

        if (\is_null($config = Arr::pull($this->config, "drivers.{$driver}"))) {
            return null;
        }

        $connection = $this->config['connection'] ?? null;

        if (! \is_null($connection) && $this->driverExcludedByOptions($driver, $connection['options'])) {
            $connection = null;
        }

        return $this->config[$driver] = \array_merge($config, ['connection' => $connection]);
    }
933307
protected function createDriver($driver)
    {
        try {
            return parent::createDriver($driver);
        } catch (Exception $e) {
            if ($newDriver = $this->nextDriver($driver)) {
                return $this->createDriver($newDriver);
            }
            throw $e;
        }
    }
444979
static private function getDriver() {
        if (self::$_driver != null) return self::$_driver;
        
        $driver = Utils::spare(Config::get('session.driver'), 'default');

        switch (strtolower($driver)) {
            case 'cookie':
                self::$_driver = new \Lollipop\Session\Cookie();
                break;
                
            case 'default':
            default:
                self::$_driver = new \Lollipop\Session\Session();
                break;
        }
        
        return self::$_driver;
    }
163864
public function get(string $key): DriverInterface
    {
        if (!$this->has($key)) {
            throw new DriverNotFoundException('Driver you are looking for doesn\'t exist. Make sure that ' . $key . ' driver is properly configured.');
        }

        return $this->drivers[$key]::install($this->appConfiguration);
    }
531730
protected function _getMinkDriver($sDriver)
    {
        $browserName = $this->getTestConfig()->getBrowserName();
        switch ($sDriver) {
            case 'selenium':
                $client = $this->_getClient();
                $oDriver = new \Behat\Mink\Driver\SeleniumDriver($browserName, shopURL, $client);
                break;
            default:
                throw new Exception('Driver ' . $sDriver . ' not supported any more!');
                break;
        }

        return $oDriver;
    }
963292
public function get($driver, $default = null)
    {
        if (isset($this->drivers[$driver])) {
            return $this->drivers[$driver]->resolve();
        }

        return $default;
    }
558745
private function findDriver($driver = '')
    {
        if (isset($this->driverList[$driver])) {
            $driver = $this->driverList[$driver];
        } else {
            throw new DriverNotFoundException(sprintf('%s adında bir sürücü bulunamadı', $driver));
        }

        if (is_string($driver)) {
            $callableName = "create" . ucfirst($driver) . "Driver";
            $response = call_user_func([$this, $callableName]);
        } elseif (is_callable($driver)) {
            $response = $driver();
        }

        return $response;
    }
1196648
public function getDriver()
    {
        if ($this->driver) {
            return $this->driver;
        }

        // Get driver configuration
        $config = $this->getConfig('drivers.' . $this->getConfig('driver'), []);

        // Get driver class
        $driver = Arr::pull($config, 'class');

        // Create driver instance
        return $this->driver = new $driver($config, $this->locale);
    }
1142759
public static function getInstance($driver)
    {
        $driver = ucfirst($driver);

        if (!isset(static::$instances[$driver])) {
            $class = sprintf('Windwalker\Database\Driver\%s\%sType', $driver, $driver);

            static::$instances[$driver] = new $class();
        }

        return static::$instances[$driver];
    }
862002
public function resolve($driver)
    {
        if ($driver instanceof Grid\Exporters\AbstractExporter) {
            return $driver->setGrid($this->grid);
        }

        return $this->getExporter($driver);
    }
1144218
public function isDriverEnabled($driver)
    {
        $this->validateDriver($driver);

        $drivers = $this->getDriversFromStorage();

        return isset($drivers[$driver]);
    }
1200619
public function driver(AbstractDriver $driver = null)
    {
        if ($driver === null) {
            return $this->getDriver();
        }

        return $this->setDriver($driver);
    }
149448
public function make($data)
    {
        $driver = $this->instance ?? $this->createDriver();

        return $driver->init($data);
    }
660887
protected function validateDriver($driver)
    {
        $interface = $this->interface();

        if (! (new ReflectionClass($driver))->implementsInterface($interface)) {
            throw new InvalidDriverException(get_class($driver)." does not implement {$interface}");
        }

        return $driver;
    }