Create a new driver instance.

@param  string  $driver

@throws \InvalidArgumentException

@return mixed
327032
protected function createDriver($driver)
    {
        $name = "orchestra.publisher.{$driver}";

        if (! $this->app->bound($name)) {
            throw new RuntimeException("Unable to resolve [{$driver}] publisher");
        }

        return $this->app->make($name);
    }
454139
protected function createDriver($driver, array $settings = [], $resolve = true)
    {
        $class = $this->getNamespace() . '\\' . studly_case($driver) . $this->getClassSuffix();

        // 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, $settings);
        } elseif (class_exists($class)) {
            $instance = $this->container->make($class);

            if ($resolve) {
                return $instance->resolve($settings);
            }

            return $instance;
        }

        throw new DriverNotFound("Driver [$driver] not supported.");
    }
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;
    }
110736
public function getManager(Driver $driver)
    {
        if (!in_array($driver->getDriver(), array_keys($this->managers))) {
            throw new DriverNotFoundException($driver->getDriver());
        }

        $manager = $this->managers[$driver->getDriver()];
        $manager->setModelClass($this->modelClass);

        return $manager;
    }
947708
public static function createInstance($driver, $options)
    {
        if(!in_array($driver, self::$_validDrivers)) {
            throw new \Exception("Driver '{$driver}' not implemented");
        }

        $class = __NAMESPACE__ . '\\Driver\\' . $driver;

        $driver = new $class;
        $driver->setOptions($options);

        return new Storage($driver);
    }
335910
public static function createDbo($driver, array $options)
    {
        // Sanitize the database connector options.
        $options['driver'] = preg_replace('/[^A-Z0-9_\.-]/i', '', $driver);
        $options['database'] = $options['database'] ?? null;
        $options['select'] = $options['select'] ?? true;

        // Use custom Resource
        $resource = $options['resource'] ?? null;

        // Derive the class name from the driver.
        $class = '\\Windwalker\\Database\\Driver\\' . ucfirst(strtolower($options['driver'])) . '\\'
            . ucfirst(strtolower($options['driver'])) . 'Driver';

        // If the class still doesn't exist we have nothing left to do but throw an exception.  We did our best.
        if (!class_exists($class)) {
            throw new \RuntimeException(sprintf('Unable to load Database Driver: %s', $options['driver']));
        }

        /** @var DatabaseDriverInterface $class */
        if (!$class::isSupported()) {
            throw new \RangeException('Database driver ' . $driver . ' not supported.');
        }

        // Create our new Driver connector based on the options given.
        try {
            $instance = new $class($resource, $options);
        } catch (\RuntimeException $e) {
            throw new \RuntimeException(sprintf('Unable to connect to the Database: %s', $e->getMessage()));
        }

        return $instance;
    }
1101632
public function getExceptionAdapter($driver) {
		if (!isset($this->exceptionAdapters[$driver])) {
			$this->exceptionAdapters[$driver] = $this->createExceptionAdapter(
				$driver);
		}
		return $this->exceptionAdapters[$driver];
	}
197323
public function create(string $driver, array $options = []){
        if(!class_exists($driver)){
            throw new \InvalidArgumentException();
        }

        $driver   = new $driver($options);

        if(!($driver instanceof Driver\AbstractDriver)){
            throw new \InvalidArgumentException();
        }

        return $driver;
    }
1337810
protected function createCacheHandler($driver)
    {
        $handler = parent::createCacheHandler($driver);
        if (!$this->validateCacheHandler($driver, $handler)) {
            throw new \UnexpectedValueException('Wrong cache driver found');
        }
        return $handler;
    }
941272
public function addDriver(DriverInterface $driver)
    {
        $driver->setConnector($this);
        $this->driverList[$driver->getDriverId()] = $driver;

        return $this;
    }
745125
public function driverInstance(string $driver): ?ITaxFacade
    {
        if (($driverClass = $this->getDriver($driver)) !== null) {
            return app($driverClass, [
                'config' => config('taxes.' . $driverClass),
            ]);
        }

        return null;
    }
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;
	}
1221955
protected function createDriver($driver)
    {
        $config = config("payments.{$driver}", null);
        if (is_string($config)) {
            return $this->createDriver($config);
        }
        if ($config === null) {
            throw new InvalidArgumentException("Driver [$driver] not supported.");
        }
        $provider = $config['provider'] ?? null;

        // 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[$provider])) {
            $config['shop'] = $driver;
            return tap(
                $this->callCustomCreator($provider, $config),
                function (PaymentProviderInterface $provider) use ($driver) {
                    $provider->setLogger(
                        new Logger($driver, [new RotatingFileHandler(storage_path("logs/{$driver}.log"))])
                    );
                }
            );
        }
        throw new InvalidArgumentException("Provider [$provider] not supported.");
    }
664169
public static function make(array $options = [], $driver = null)
    {
        $class = null;

        if (!$driver && isset($options['driver'])) {
            $driver = $options['driver'];
            unset($options['driver']);
        }

        /** @var LockInterface $class */
        if (isset(self::$driverMap[$driver])) {
            $class = self::$driverMap[$driver];

        } else {
            foreach ([self::DRIVER_SEM, self::DRIVER_FILE] as $name) {
                $class = self::$driverMap[$name];

                if ($class::isSupported()){
                    break;
                }
            }
        }

        if (!$class) {
            throw new \RuntimeException('No available driver! MAP: ' . implode(',', self::$driverMap));
        }

        return new $class($options);
    }
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;
	}
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.");
    }
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];
    }