Creates driver based on browser configuration.

@return DriverInterface
437936
public function createDriver()
	{
		$factory = $this->_driverFactoryRegistry->get($this->getDriver());

		return $factory->createDriver($this);
	}
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;
    }
410671
private static function driver()
    {
        $options = config('cache.options');

        $driver = config('cache.default');

        switch ($driver) {
            case 'file':
                    return instance(FileDriver::class);
                break;

            case 'apc':
                    return instance(ApcDriver::class);
                break;

            case 'database':
                    return instance(PDODriver::class);
                break;

            default:
                    exception(DriverNotFoundException::class);
                break;
        }
    }
140711
public function build()
    {
        $capabilities = $this->makeCapabilities($this->type, $this->extraCapabilities);

        $this->remoteWebDriver = RemoteWebDriver::create(
            $this->url,
            $capabilities,
            $this->connectionTimeout,
            $this->requestTimeout
        );

        // define web driver configurations before being decorated
        if ($this->implicitTimeout > 0) {
            $this->remoteWebDriver->manage()->timeouts()->implicitlyWait($this->implicitTimeout);
        }

        // translator
        $baseUrlId = UrlTranslator::BASE_URL_IDENTIFIER;
        $baseUrl = array_key_exists($baseUrlId, $this->urls) ? $this->urls[$baseUrlId] : null;
        $this->urlTranslator = new UrlTranslator($this->urls, $baseUrl);

        return $this;
    }
933307
protected function createDriver($driver)
    {
        try {
            return parent::createDriver($driver);
        } catch (Exception $e) {
            if ($newDriver = $this->nextDriver($driver)) {
                return $this->createDriver($newDriver);
            }
            throw $e;
        }
    }
957061
public function createDriver(BrowserConfiguration $browser)
	{
		if ( !class_exists('Behat\Mink\Driver\ZombieDriver') ) {
			throw new \RuntimeException(
				'Install MinkZombieDriver in order to use zombie driver.'
			);
		}

		$driver_options = $browser->getDriverOptions();

		return new \Behat\Mink\Driver\ZombieDriver(
			new \Behat\Mink\Driver\NodeJS\Server\ZombieServer(
				$browser->getHost(),
				$browser->getPort(),
				$driver_options['node_bin'],
				$driver_options['server_path'],
				$driver_options['threshold'],
				$driver_options['node_modules_path']
			)
		);
	}
1252586
protected function createNewConnection(): \Plasma\DriverInterface {
        $connection = $this->factory->createDriver();
        
        // We relay a driver's specific events forward, e.g. PostgreSQL notifications
        $connection->on('eventRelay', function (string $eventName, ...$args) use (&$connection) {
            $args[] = $connection;
            $this->emit($eventName, $args);
        });
        
        $connection->on('close', function () use (&$connection) {
            $this->connections->delete($connection);
            $this->busyConnections->delete($connection);
            
            $this->emit('close', array($connection));
        });
        
        $connection->on('error', function (\Throwable $error) use (&$connection) {
            $this->emit('error', array($error, $connection));
        });
        
        $connection->connect($this->uri)->then(function () use (&$connection) {
            $this->connections->add($connection);
            $this->busyConnections->delete($connection);
        }, function (\Throwable $error) use (&$connection) {
            $this->connections->delete($connection);
            $this->busyConnections->delete($connection);
            
            $this->emit('error', array($error, $connection));
        });
        
        return $connection;
    }
1241370
public function getDriver()
    {
        if ($this->driver === null) {
            // Get driver configuration
            $config = $this->config('drivers.' . $this->config('driver'), []);

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

            // Create driver instance
            $this->driver = new $driver($config);
        }

        return $this->driver;
    }
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];
    }
441708
public function make(string $driver): ClientContract
    {
        $config = $this->app->make('config')->get("microservice-client.clients.{$driver}");
        $options = $this->serviceConfig();

        switch ($config['name']) {
            case 'restful':
                return new Restful($this->app->make('client.manager'), $config, $options);
        }

        throw new InvalidArgumentException("Unsupported driver [{$config['name']}]");
    }
560786
public function getDriver($driver = null)
    {
        $driver = ($driver) ?: array_get($this->config, 'driver', '');

        $method = 'create'.ucfirst(camel_case($driver)).'Driver';

        if (! method_exists($this, $method)) {
            throw new InvalidDriverException(sprintf('Driver [%s] not supported.', $driver));
        }

        return $this->{$method}(array_get($this->config, $driver, []));
    }
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.");
    }
746568
public function driver($driver = null, array $settings = [], $resolve = true)
    {
        $driver = $driver ?: $this->getDefaultDriver();

        return $this->createDriver($driver, $settings, $resolve);
    }
1359198
private function createDriver($config)
    {
        $fullConfig = ArrayHelper::merge(
            [
                'class' => $config['class'],
                'url' => $this->url,
                'title' => $this->title,
                'description' => $this->description,
                'imageUrl' => $this->imageUrl,
                'registerMetaTags' => $this->registerMetaTags(),
            ],
            isset($config['config']) ? $config['config'] : [],
            isset($this->driverProperties[$config['class']]) ? $this->driverProperties[$config['class']] : []
        );

        return Yii::createObject($fullConfig);
    }
1281703
public function connect(): DriverInterface
    {
        try {
            $connection = new PDO(
                $this->getDsn(),
                $this->getParam('username'),
                $this->getParam('password'),
                $this->getOptions()
            );
            $this->setInstance($connection);

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

        return $this;
    }
1158225
public function createSmartDriver(){
        $config = $this->app['config']->get('sms.smart', []);
        $driver = new Smart($config['token'], $config['wsdl'], $config['service']);

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

        return $this->setDriver($driver);
    }