ドライバを生成する

@param   string  $driver
@param   mixed[] $options

@return  Driver\AbstractDriver

@throws  \InvalidArgumentException
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;
    }
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];
    }
1122966
function LoadDriver($driver) {
		$driver = strtolower($driver);
		if ($driver == $this->_activeDriver) // Already loaded this driver
			return TRUE;
		if (!file_exists($file = dirname(__FILE__) . "/drivers/$driver.php"))
			return;
		require_once($file);
		$driverName = "RefLib_" . ucfirst($driver);
		$this->driver = new $driverName();
		$this->driver->parent = $this;
		$this->_activeDriver = $driver;
		return TRUE;
	}
891978
public static function create(array $options) {
        $authenticatorClass = !empty($options['driverOptions']['authenticator_class']) ? $options['driverOptions']['authenticator_class'] : 'NoAuthentication';
        $className          = preg_match('/\\\\/', $authenticatorClass) ? $authenticatorClass : 'Circle\DoctrineRestDriver\Security\\' . $authenticatorClass;
        Assertions::assertClassExists($className);

        return self::assert(new $className($options));
    }
950802
public function driver($driver = '', array $configs = [])
    {
        $driverList = $this->getDriverList();

        if (!count($configs)) {
            $configs = isset($this->getConfig()[$driver]) ? $this->getConfig()[$driver] : [];
        }

        if (isset($driverList[$driver])) {
            $driver = $driverList[$driver];
        }

        if (is_string($driver)) {
            $driver = new $driver;
        }

        return $this->setDriver($driver, $configs);
    }
1129146
public static function getDsn($driver, $options = [])
    {
        self::$options = $options;

        if (!is_callable([static::class, $driver])) {
            throw new \DomainException('The ' . $driver . ' driver is not supported.');
        }

        list($dsn, $replace) = static::$driver();

        $dsn = strtr($dsn, $replace);

        self::$options = [];

        return $dsn;
    }
666376
public function driver(string $driver): DriverInterface
    {
        if (isset($this->drivers[$driver])) {
            return $this->drivers[$driver];
        }
        try {
            return $this->drivers[$driver] = $this->config->getDriver($driver)->resolve($this->factory);
        } catch (ContainerExceptionInterface $e) {
            throw new DBALException($e->getMessage(), $e->getCode(), $e);
        }
    }
691544
protected function getConnector($driver)
    {
        if (isset($this->connectors[$driver]))
        {
            return call_user_func($this->connectors[$driver]);
        }

        throw new \InvalidArgumentException("No connector for [$driver]");
    }
1091971
public function createConnector(array $config)
    {
        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('A driver must be specified.');
        }

        switch ($config['driver']) {
            case 'buzz':
                return new BuzzConnector();
            case 'guzzle':
                return new GuzzleConnector();
            case 'guzzlehttp':
                return new GuzzleHttpConnector();
        }

        throw new InvalidArgumentException("Unsupported driver [{$config['driver']}].");
    }
1268593
public static function loadDriver($driver, $explicit = false)
    {
        array_unshift(self::$drivers, $driver);
        if (method_exists($driver, 'loadExtension')) {
            call_user_func([$driver, 'loadExtension']);
        }

        if (method_exists($driver, 'additionalDrivers') && $explicit === false) {
            $additionalDrivers = (array) call_user_func([$driver, 'additionalDrivers']);
            foreach ($additionalDrivers as $additionalDriver) {
                self::loadDriver($additionalDriver);
            }
        }

        self::$drivers = array_unique(self::$drivers);
    }
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;
    }
746568
public function driver($driver = null, array $settings = [], $resolve = true)
    {
        $driver = $driver ?: $this->getDefaultDriver();

        return $this->createDriver($driver, $settings, $resolve);
    }
126944
public function createDriver($options = [])
    {
        $options = $this->optionsResolver->resolve($options);

        return new CollectionDriver($this->extensions, $options['collection'], $options['criteria']);
    }
866183
protected function driverExcludedByOptions(string $driver, array $options): bool
    {
        return (! empty($options['only']) && ! \in_array($driver, (array) $options['only'])) ||
            (! empty($options['except']) && \in_array($driver, (array) $options['except']));
    }
811309
public function driver($driver = null)
    {
        $shortener = $this->app['config']['shortener'];

        $driver = $driver ?: $shortener['default'];

        $driverMethod = 'create'.ucfirst($driver).'Driver';

        if (method_exists($this, $driverMethod)) {
            return $this->{$driverMethod}($shortener);
        }

        throw new InvalidArgumentException("Driver [{$driver}] is not supported.");
    }
1150392
public static function createConnectionObj($driver, array $config)
    {
        switch ($driver) {
            case 'mysql' :
                return new Mysql($config);
                break;
            case 'postgresql' :
                return new Postgresql($config);
                break;
            case 'sqlite' :
                return new Sqlite($config);
                break;
            case 'oracle' :
                return new Oracle($config);
                break;
            default :
                $debug_msg = "~/config/database.php文件配置错误！不支持的数据库驱动类型 - " . strval($driver);
                throw new \InvalidArgumentException($debug_msg);
        }
    }
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;
	}