Returns the data driver.

@return \BearFramework\App\IDataDriver
@throws \Exception
167304
private function getDriver(): \BearFramework\App\IDataDriver
    {
        if ($this->driver !== null) {
            return $this->driver;
        }
        throw new \Exception('No data driver specified! Use useFileDriver() or setDriver() to specify one.');
    }
769628
public function getDataSQLBuilder()
    {
        if (!isset($this->dataSqlBuilder)) {
            $this->dataSqlBuilder = $this->getGeneratorConfig()->getConfiguredBuilder($this->getTable(), 'datasql');
        }

        return $this->dataSqlBuilder;
    }
600842
public function getAdapter()
    {
        if (isset($this->adapter)) {
            return $this->adapter;
        }
        
        $options = $this->getOptions();
        if (isset($options['connection'])) {
            if (!($options['connection'] instanceof \PDO)) {
                throw new \RuntimeException('The specified connection is not a PDO instance');
            }

            $options['connection']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
            $options['adapter'] = $options['connection']->getAttribute(\PDO::ATTR_DRIVER_NAME);
        }
        if (!isset($options['adapter'])) {
            throw new \RuntimeException('No adapter was specified for environment: ' . $this->getName());
        }

        $factory = AdapterFactory::instance();
        $adapter = $factory
            ->getAdapter($options['adapter'], $options);

        // Automatically time the executed commands
        $adapter = $factory->getWrapper('timed', $adapter);

        if (isset($options['wrapper'])) {
            $adapter = $factory
                ->getWrapper($options['wrapper'], $adapter);
        }

        if ($this->getInput()) {
            $adapter->setInput($this->getInput());
        }

        if ($this->getOutput()) {
            $adapter->setOutput($this->getOutput());
        }

        // Use the TablePrefixAdapter if table prefix/suffixes are in use
        if ($adapter->hasOption('table_prefix') || $adapter->hasOption('table_suffix')) {
            $adapter = AdapterFactory::instance()
                ->getWrapper('prefix', $adapter);
        }

        $this->setAdapter($adapter);

        return $adapter;
    }
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;
    }
112999
public function getAdapter() {
		if ($this->_adapter === null) {
			if ($this->hasLocator()) {
				$this->_adapter = $this->getLocator()->get($this->getAdapterName());
			} else {
				throw new Exceptions\NoAdapter('Nor a database adapter neither a services locator has been provided');
			}
		}
		
		return $this->_adapter;
	}
969666
public function getDriver()
    {
        $config = $this->config;
        if ($this->isLegacy()) {
            $appEntityPath = DIR_APPLICATION . '/' . DIRNAME_CLASSES;
            $reader = $this->app->make('orm/cachedSimpleAnnotationReader');
        } else {
            $appEntityPath = DIR_APPLICATION . '/' . DIRNAME_CLASSES . '/' . DIRNAME_ENTITIES;
            $reader = $this->app->make('orm/cachedAnnotationReader');
        }

        $appDriverSettings = $config->get(CONFIG_ORM_METADATA_APPLICATION);
        $xmlConfig = DIR_APPLICATION . '/' . REL_DIR_METADATA_XML;
        $ymlConfig = DIR_APPLICATION . '/' . REL_DIR_METADATA_YAML;

        // Default setting so it comes first
        if (empty($appDriverSettings) && is_dir($appEntityPath)) {
            return new AnnotationDriver($reader, $appEntityPath);
        } else {
            if ($appDriverSettings === 'xml') {
                if (is_dir($xmlConfig)) {
                    return new XmlDriver($xmlConfig);
                } else {
                    // Fallback to default
                    return new AnnotationDriver($reader, $appEntityPath);
                }
            } else {
                if ($appDriverSettings === 'yaml' || $appDriverSettings === 'yml') {
                    if (is_dir($ymlConfig)) {
                        return new YamlDriver($ymlConfig);
                    } else {
                        // Fallback to default
                        return new AnnotationDriver($reader, $appEntityPath);
                    }
                }
            }
        }
    }
655360
public function getController()
    {
        if ($this->controller) {
            return $this->controller;
        }

        $controllerClass = self::config()->controller_class;

        if (!class_exists($controllerClass)) {
            throw new Exception(
                'Could not find controller class ' . $controllerClass . ' as defined in ' . static::class
            );
        }

        $this->controller = Injector::inst()->create($controllerClass, $this);
        $this->controller->doInit();

        return $this->controller;
    }
87225
protected function getRouter(): RouterDriver
    {
        if (!$this->drivers->get('router') instanceof RouterDriver) {
            throw new DriverNotSupportedException('Provided router driver is not supported.');
        }

        return $this->drivers->get('router');
    }
1011015
public function getController()
    {
        if ($this->controller) {
            return $this->controller;
        }

        foreach (array_reverse(ClassInfo::ancestry(get_class($this))) as $widgetClass) {
            $controllerClass = "{$widgetClass}Controller";
            if (class_exists($controllerClass)) {
                break;
            }
        }

        if (!class_exists($controllerClass)) {
            throw new Exception('Could not find controller class for ' . static::class);
        }

        $this->controller = Injector::inst()->create($controllerClass, $this);
        if (Injector::inst()->has(HTTPRequest::class)) {
            $this->controller->setRequest(Injector::inst()->get(HTTPRequest::class));
        }

        return $this->controller;
    }
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)));
	}
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;
    }
1033200
public function connect(): DriverInterface
    {
        try {
            $connection = new PDO(
                $this->getDsn(),
                $this->getParam('username'),
                $this->getParam('password')
            );

            // We allow to print the errors whenever there is one
            $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

            $this->setInstance($connection);

        } catch (SQLException $e) {
            // __construct
        }

        return $this;
    }
434677
public function getDriver()
    {
        // if driver status is false, we return the BlackHole driver
        if (!$this->getStatus()) {
            if (is_null(self::$nullDriver)) {
                self::$nullDriver = new Storage\BlackHole();
            }

            return self::$nullDriver;
        }

        return $this->driver;
    }
511203
public function getAdapter()
    {
        if (empty($this->adapter)) {
            $user = $this->getUser();
            $sessionDataStored = $user->getAuthSession($this->providerKey);
            $hybridAuth = $this->getHybridAuth();
            if (!empty($sessionDataStored)) {
                $hybridAuth->restoreSessionData($sessionDataStored);
            }
            $adapter = $hybridAuth->authenticate($this->providerKey);
            $sessionData    = $hybridAuth->getSessionData();
            if ($sessionData != $sessionDataStored) {
                $user->updateAuthSession($this->providerKey, $sessionData);
            }
            $this->adapter = $adapter;
        }
        return $this->adapter;
    }
37964
public function getDriver()
    {
        // Attempt to retrieve the driver config
        $config = new Config($this->configDirectory);
        $driverClass = $config->getDriver();
        // Validate Driver Class
        $reflection = new ReflectionClass($driverClass);
        // Ensure class is built with the correct interface
        if (false === $reflection->implementsInterface('Signalert\Storage\DriverInterface')) {
            throw new SignalertResolverException;
        }
        // If it all checks out, resolve the class and instantiate
        return $reflection->newInstance();

    }
161324
public function LoadDriver()
	{

		if ($this->_driver == null)
		{
			require_once("verysimple/IO/Includer.php");
			
			// the driver was not explicitly provided so we will try to create one from
			// the connection setting based on the database types that we do know about
			switch($this->ConnectionSetting->Type)
			{
				case "mysql":
					include_once("verysimple/DB/DataDriver/MySQL.php");
					$this->_driver  = new DataDriverMySQL();
					break;
				case "mysqli":
					include_once("verysimple/DB/DataDriver/MySQLi.php");
					$this->_driver  = new DataDriverMySQLi();
					break;
				case "sqlite":
					include_once("verysimple/DB/DataDriver/SQLite.php");
					$this->_driver  = new DataDriverSQLite();
					break;
				default:
					try
					{
						Includer::IncludeFile("verysimple/DB/DataDriver/".$this->ConnectionSetting->Type.".php");
						$classname = "DataDriver" . $this->ConnectionSetting->Type;
						$this->_driver  = new $classname();
					}
					catch (IncludeException $ex)
					{
						throw new Exception('Unknown DataDriver "' . $this->ConnectionSetting->Type . '" specified in connection settings');
					}
					break;
			}
		
			DataAdapter::$DRIVER_INSTANCE = $this->_driver;
		
		}
	}
414420
public static function getSessionHandler() {
        $sessionDriver = get_config('session_driver');
        
        self::$sessionDriver = $sessionDriver ? $sessionDriver : 'native';

        if (self::$sessionDriver) {
            switch (self::$sessionDriver) {
                case 'native':
                    self::$sessionHandler = new Session(get_config('session_timeout'));
                    break;
                case 'database':
                    self::$sessionHandler = new DbSession(get_config('session_timeout'));
                    break;
            }
        }

        if (self::$sessionHandler) {
            return self::$sessionHandler;
        } else {
            throw new \Exception(ExceptionMessages::MISCONFIGURED_SESSION_HANDLER);
        }
    }