Establish a queue connection.

@param  array  $config
@return \Illuminate\Contracts\Queue\Queue
544504
public function connect(array $config)
    {
        $queue = new PHPRedisQueue(
            $this->redis, $config['queue'], Arr::get($config, 'connection', $this->connection)
        );

        $queue->setExpire(Arr::get($config, 'expire', 60));

        return $queue;
    }
899352
public static function createRedisByConfig(array $config) {
        $Redis = new Connection();
        $Redis->setHost(@$config['host'])
            ->setPort(@$config['port']);
        (isset($config['persistent']))      && $Redis->setPersistent($config['persistent']);
        (isset($config['connect_timeout'])) && $Redis->setConnectTimeout($config['connect_timeout']);
        (isset($config['connect_tries']))   && $Redis->setConnectTries($config['connect_tries']);
        return $Redis;
    }
257880
public function fromConfig(array $config)
    {
        if ($this->env === 'dev' && php_sapi_name() !== 'cli') {
            //for performance reason only in dev mode: https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_configuration.html#enabling_logger
            $config['Tracer'] = $this->logger;
        }
        $config['connectionPool'] = SniffingConnectionPool::class;

        return ClientBuilder::fromConfig($config);
    }
1207556
public function connect(array $config): PDO
    {
        if (isset($config['options']) === false) {
            $config['options'] = [];
        }

        return $this->doConnect($config);
    }
835560
public function connect(array $config, array $options)
    {
        return new PredisConnection(
            new Client(
                $config, array_merge(
                    ['timeout' => 10.0], $options, Arr::pull($config, 'options', [])
                )
            )
        );
    }
599020
public function connect($config = array())
    {
        if (empty($this->mongo)) {
            $options = array();
            if (!empty($config['options'])) {
                $options = $config['options'];
            }
            $this->mongo = new \MongoClient($config['dsn'], $options);

        }
    }
115093
public function build(array $config)
    {
        $router = new Router();
        foreach ($config as $name => $route) {
            if ($route instanceof RouteInterface) {
                $router->register($name, $route);
                continue;
            }

            $route = $this->applyDefaults($route);

            $router->register(
                $name,
                $this->createDefinition($route)
            );
        }

        return $router;
    }
865711
public function connect(array $config)
    {
        $auth = $this->getAuth($config);
        $client = $this->getClient($auth);

        return $this->getAdapter($client);
    }
689492
protected function initialiseClient(array $config = [])
    {
        if (!isset($config['handler']) || !$config['handler'] instanceof HandlerStack) {
            $handlerStack = HandlerStack::create(new CurlHandler());
            $handlerStack->push(
                Middleware::retry(
                    $this->retryDecider()
                )
            );

            $config['handler'] = $handlerStack;
        }

        return new Client($config);
    }
1158155
protected function getClient(array $config)
    {
        $name = array_get($config, 'connector');

        return $this->cache->driver($name)->getStore();
    }
1195463
protected function createServerSocket(array $config)
    {
        $protocol = $config['protocol'] ?? 'tcp';

        if (isset($this->serverSocketExtensions[$protocol])) {
            $serverSocket = call_user_func($this->serverSocketExtensions[$protocol], $this->app, $config);

            if (! $serverSocket instanceof ServerSocketContract) {
                throw new InvalidArgumentException(
                    "The protocol [{$protocol}] resolver must return a ServerSocket instance."
                );
            }

            return $serverSocket;
        }

        if (method_exists($this, $method = 'create'.Str::studly($protocol).'ServerSocket')) {
            return $this->$method($config);
        }

        throw new InvalidArgumentException("The protocol [{$protocol}] is not supported.");
    }
698713
public function createConnection($config)
    {
        $driver = $this->driver_manager->driver(array_get($config, 'driver', ''));

        if (!($driver instanceof \Doctrine\DBAL\Driver)) {
            $driver = $this->driver_manager->driver();
        }

        $params = $config;
        $params['host'] = array_get($params, 'host', array_get($config, 'server'));
        $params['user'] = array_get($params, 'user', array_get($config, 'username'));
        if (!isset($params['driverOptions'])) {
            $params['driverOptions'] = [];
        }
        if (defined('PDO::MYSQL_ATTR_MULTI_STATEMENTS')) {
            $params['driverOptions'][\PDO::MYSQL_ATTR_MULTI_STATEMENTS] = false;
        }
        $params['wrapperClass'] = array_get($config, 'wrapperClass', '\Concrete\Core\Database\Connection\Connection');
        unset($params['driver']);

        $wrapperClass = 'Doctrine\DBAL\Connection';
        if (isset($params['wrapperClass'])) {
            if (is_subclass_of($params['wrapperClass'], $wrapperClass)) {
                $wrapperClass = $params['wrapperClass'];
            } else {
                throw DBALException::invalidWrapperClass($params['wrapperClass']);
            }
        }

        $connection =  new $wrapperClass($params, $driver);
        $connection->getDatabasePlatform()->registerDoctrineTypeMapping('json', 'json_array');
        return $connection;
    }
1182272
public function make(array $config)
    {
        Arr::requires($config, ['token']);

        $client = new Client();

        return new HipchatGateway($client, $config);
    }
1247607
public function connect(array $config)
    {
        return new DatabaseQueue(
            $this->connections->connection(array_get($config, 'connection')),
            array_get($config, 'table', 'queues'),
            array_get($config, 'queue', null),
            array_get($config, 'expire', 60),
            array_get($config, 'lock_type', 60)
        );
    }
1285342
public function connect(array $config)
    {
        $tns = ! empty($config['tns']) ? $config['tns'] : $this->getDsn($config);

        $options = $this->getOptions($config);

        if (array_get($options, 'session_mode') === OCI_CRED_EXT) {
            // External connections can only be used with user / and an empty password
            $config['username'] = '/';
            $config['password'] = null;
        }

        $connection = $this->createConnection($tns, $config, $options);

        return $connection;
    }
271982
private function getRedisConnection(array $config)
    {
        $redis = new \Redis();
        $host = isset($config['host']) ? $config['host'] : 'localhost';

        if (isset($config['port'])) {
            $redis->connect($host, $config['port']);
        } else {
            $redis->connect($host);
        }

        return $redis;
    }
510034
protected function createReadWriteConnection(array $config)
    {
        $connection = $this->createSingleConnection($this->getWriteConfig($config));

        return $connection->setReadPdo($this->createReadPdo($config));
    }