Create an instance of the driver.

@param  array  $config
@return \Nova\Broadcasting\BroadcasterInterface
558733
protected function createLogDriver(array $config)
    {
        $logger = $this->app->make('Psr\Log\LoggerInterface');

        return new LogBroadcaster($this->app, $logger);
    }
1361621
private function createDriver(array $config)
	{
		if (empty($config['driver'])) {
			throw new InvalidStateException('Undefined driver');
		} elseif ($config['driver'] instanceof IDriver) {
			return $config['driver'];
		} else {
			$name = ucfirst($config['driver']);
			$class = "Mva\\Dbm\\Driver\\{$name}\\{$name}Driver";
			return new $class;
		}
	}
1081956
public static function createFromConfig(array $config)
    {
        $fields = [];
        foreach ($config as $name => $field) {
            $fields[$name] = Fields::create($name, $field);
        }
        return new static($fields);
    }
1170779
protected function createClient(array $config)
    {
        $url = Arr::pull($config, 'url');

        $urls = parse_url($url);

        $config['host'] = $urls['host'];
        $config['port'] = $urls['port'];

        switch ($urls['scheme']) {
            case 'http':
                return new HttpClient($this->app, $this->serializerFactory, $config);
            case 'whisper':
                return new WhisperClient($this->app, $this->serializerFactory, $config);
            default:
                throw new InvalidArgumentException('Protocol '.$urls['scheme'].' is not supported for Homer.');
        }
    }
343191
protected function createDynamodbDriver(array $config)
    {
        $dynamoConfig = [
            'region' => $config['region'],
            'version' => 'latest',
        ];

        if ($config['key'] && $config['secret']) {
            $dynamoConfig['credentials'] = Arr::only(
                $config, ['key', 'secret', 'token']
            );
        }

        return $this->repository(
            new DynamoDbStore(
                new DynamoDbClient($dynamoConfig),
                $config['table'],
                $config['attributes']['key'] ?? 'key',
                $config['attributes']['value'] ?? 'value',
                $config['attributes']['expiration'] ?? 'expires_at',
                $this->getPrefix($config)
            )
        );
    }
759141
protected function createRedisDriver( array $config )
	{
		$redis = Framework::get( 'redis' );

		$connection = Arr::get( $config, 'connection', 'default' );

		return new RedisStore( $redis, $this->getPrefix( $config ), $connection );
	}
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];
    }
573398
protected function createSwooleServer(array $config)
    {
        return new SwooleServer(
            $this->serverSocket->getHost(),
            $this->serverSocket->getPort(),
            $this->parseServerMode($config),
            $this->serverSocket->getSocketType()
        );
    }
329224
public static function factory($config = array())
	{
		$client = new self($config['baseURL'], $config);
		$client->setDefaultOption('headers/Content-Type', 'application/json');
		$client->setDefaultOption('X-Kinvey-API-Version', 2);
		$client->setAuthMode($config['defaultAuthMode']);

		$client = self::registerPlugins($client);

		return $client;
	}
823939
public static function create(Config $config)
    {
        if (php_sapi_name() === 'cli' || !(self::$instance instanceof self)) {
            self::$instance = new self($config);
        }

        return self::$instance;
    }
631737
protected function makeKafkaAdapter(array $config)
    {
        // create producer
        $producer = $this->container->makeWith('pubsub.kafka.producer');
        $producer->addBrokers($config['brokers']);

        // create consumer
        $topicConf = $this->container->makeWith('pubsub.kafka.topic_conf');
        $topicConf->set('auto.offset.reset', 'smallest');

        $conf = $this->container->makeWith('pubsub.kafka.conf');
        $conf->set('group.id', array_get($config, 'consumer_group_id', 'php-pubsub'));
        $conf->set('metadata.broker.list', $config['brokers']);
        $conf->set('enable.auto.commit', 'false');
        $conf->set('offset.store.method', 'broker');
        $conf->setDefaultTopicConf($topicConf);

        $consumer = $this->container->makeWith('pubsub.kafka.consumer', ['conf' => $conf]);

        return new KafkaPubSubAdapter($producer, $consumer);
    }
840387
public function make($driver, array $config = [])
    {
        switch ($driver) {
            case '/dev/null':
                return new DevNullPubSubAdapter();
            case 'local':
                return new LocalPubSubAdapter();
            case 'redis':
                return $this->makeRedisAdapter($config);
            case 'kafka':
                return $this->makeKafkaAdapter($config);
            case 'gcloud':
                return $this->makeGoogleCloudAdapter($config);
            case 'http':
                return $this->makeHTTPAdapter($config);
        }

        throw new InvalidArgumentException(sprintf('The driver [%s] is not supported.', $driver));
    }
1348949
public function make(array $config)
    {
        Arr::requires($config, ['from', 'client', 'token']);

        $client = new Client();

        return new TwilioGateway($client, $config);
    }
562757
private function createConnection($config): Connection
    {
        if (is_string($config)) {
            $config = ['url' => $config];
        }

        return DriverManager::getConnection($config, $this->configuration, $this->eventManager);
    }
323970
public function createServer(array $config)
    {
        // Mark server mode
        define('SERVER_MODE', 'swoole');

        $this->config = $config + [
            'host' => '0.0.0.0',
            'port' => '8000',
            'task_worker_num' => 0,
            'enable_websocket'=> false
        ];

        // Start websocket or http server
        if ( empty($config['enable_websocket']) ) {
            $this->server = new \Swoole\Http\Server($this->config['host'], $this->config['port']);
        } else {
            $this->config['open_http_protocol'] = true;
            $this->server = new \Swoole\WebSocket\Server($config['host'], $config['port'], SWOOLE_PROCESS, SWOOLE_SOCK_TCP);
        }

        $this->server->set($this->config);

        // Show welcome finger
        $this->printServerFinger();

        return $this;
    }
775175
protected function createCustomDriver(array $config)
    {
        $factory = is_callable($via = $config['via']) ? $via : $this->app->make($via);

        return $factory($config);
    }
433796
public function make(array $config)
    {
        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('A driver must be specified.');
        }

        return $this->factory($config['driver'])->make($config);
    }