Create a new driver instance.

@param  string  $driver
@return mixed

@throws \InvalidArgumentException
193194
protected function createDriver($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($driver);
        } else {
            $method = 'create'.Stringy::create($driver)->upperCamelize().'Driver';

            if (method_exists($this, $method)) {
                return $this->$method();
            }
        }
        throw new InvalidArgumentException("Driver [$driver] not supported.");
    }
330858
public function getDriver($driver = null, array $config = [])
    {
        $driver = strtolower($driver);

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

        return $this->drivers[$driver];
    }
564244
public static function create( $name = null, $driver = 'file' ) 
	{
		if ( is_null( $name ) ) 
		{
			return new static( null, $driver );
		}
		
		if ( !isset( static::$instances[$name] ) ) 
		{
			static::$instances[$name] = new static( $name, $driver );
		}
		
		return static::$instances[$name];
	}
587813
protected function createConnection($driver, $connection, $database, $prefix = '', $config = [])
    {
//        if ($resolver = Connection::getResolver($driver)) {
//            return $resolver($connection, $database, $prefix, $config);
//        }
        switch ($driver) {
            case 'mysql':
                return new MySqlConnection($connection, $database, $prefix, $config);
        }

        throw new InvalidArgumentException("Unsupported driver [$driver]");
    }
1076779
public static function driverClass($driver) {
        if ($driver instanceof PDO) {
            $name = $driver->getAttribute(PDO::ATTR_DRIVER_NAME);
        } else {
            $name = (string)$driver;
        }

        $name = strtolower($name);
        return isset(self::$drivers[$name]) ? self::$drivers[$name] : null;
    }
404064
public function driver($driver = null)
    {
        $driver = $driver ?: $this->getDefaultDriver();

        if (is_null($driver)) {
            throw new InvalidArgumentException(sprintf('Unable to resolve NULL driver for [%s].', get_called_class()));
        }

        // If the given driver has not been created before, we will create the instances
        // here and cache it so we can return it next time very quickly. If there is
        // already a driver created by this name, we'll just return that instance.
        if (! isset($this->drivers[$driver])) {
            $this->drivers[$driver] = $this->createDriver($driver);
        }

        return $this->drivers[$driver];
    }
373730
protected function createConfigurationAdapter($driver)
    {
        switch ($driver) {
            case self::DRIVER_MYSQL:
            case self::DRIVER_PGSQL:
            case self::DRIVER_SQLSRV:
                return new SqlAdapter();
            case self::DRIVER_SQLITE:
                return new SqliteAdapter();
            default:
                throw new Exception("Driver '{$driver}' is not supported.");
        }
    }
1310624
public function driver( $driver )
	{
		$driver = CCCORE_NAMESPACE.'\\'.'CCConfig_'.ucfirst( $driver );
		
		if ( !class_exists( $driver ) ) 
		{
			throw new \InvalidArgumentException("CCConfig - Invalid driver '".$driver."'");
		}
		
		$this->_driver = new $driver;
	}
496227
protected function createCacheHandler($driver)
    {
        $minutes = $this->app['config']['session.lifetime'];

        return new CacheBasedSessionHandler($this->app['cache']->driver($driver), $minutes);
    }
193760
public function create(PDO $pdo)
    {
        switch ($pdo->getDatabaseType()) {
            case 'mysql':
                $connection = new MySqlConnection($pdo);
                break;
            case 'pgsql':
                $connection = new PostgreSqlConnection($pdo);
                break;
            case 'sqlite':
                $connection = new SQLiteConnection($pdo);
                break;
            default:
                throw new InvalidDriverException('Not implemented driver: ' . $pdo->getDatabaseType());
        }

        return $connection;
    }
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]);
    }
851198
public function driver()
    {
        $args = func_get_args();
        $props = Driver::parseArgs($args);
        $newProps = $this->callHookHandler('beforeCreateDriver', $props);
        if (is_array($newProps)) {
            $props = array_merge($props, $newProps);
        }
        extract($props);
        $driver = Driver::create($this, $name, $weight, $backup, $work);
        $this->drivers[$name] = $driver;
        $this->callHookHandler('afterCreateDriver', $driver);

        return $driver;
    }
941272
public function addDriver(DriverInterface $driver)
    {
        $driver->setConnector($this);
        $this->driverList[$driver->getDriverId()] = $driver;

        return $this;
    }
124065
public static function create(string $driver) : Backend
    {
        if (strpos($driver, '\\') === false) {
            $class = __NAMESPACE__ . '\\Drivers\\' . studly_case($driver);
        } else {
            $class = $driver;
        }

        if (!class_exists($class)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Class `%s` does not exist, so it\'s far from being a good settings backend candidate',
                    $class
                )
            );
        }

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

        return $driver->init($data);
    }
593081
public static function driver(string $driver, AbstractRepository $repository): RepositoryDriver
    {
        switch ($driver) {
            case 'eloquent':
                return new Eloquent($repository);
            default:
                throw new InvalidArgumentException("Driver [{$driver}] not found");
        }
    }
217840
protected function setDriver($driver){
		if(strcasecmp($driver, 'sqlite') === 0) // Backward compatibility
			$driver = 'SQLite2';

		$class = "Neevo\\Drivers\\{$driver}Driver";

		if(!class_exists($class)){
			$file = __DIR__ . '/Drivers/' . strtolower($driver) . '.php';
			if(!file_exists($file))
				throw new DriverException("$driver driver file ($file) does not exist.");
			if(is_readable($file))
				include_once $file;
			else
				throw new DriverException("$driver driver file ($file) is not readable.");
		}
		if(!$this->isDriver($class))
			throw new DriverException("Class '$class' is not a valid Neevo driver class.");

		$this->driver = new $class;

		// Set statement parser
		if($this->isParser($class))
			$this->parser = $class;
	}