Return configuration for the socket client.

@param array $config Configuration from user

@return array Configuration resolved
555518
protected function configure(array $config = [])
    {
        $resolver = new OptionsResolver();
        $resolver->setDefaults($this->config);
        $resolver->setDefault('stream_context', function (Options $options) {
            return stream_context_create($options['stream_context_options'], $options['stream_context_param']);
        });

        $resolver->setDefault('timeout', ini_get('default_socket_timeout') * 1000);

        $resolver->setAllowedTypes('stream_context_options', 'array');
        $resolver->setAllowedTypes('stream_context_param', 'array');
        $resolver->setAllowedTypes('stream_context', 'resource');
        $resolver->setAllowedTypes('ssl', ['bool', 'null']);

        return $resolver->resolve($config);
    }
1050401
public static function unserialize(array $config)
    {
        $configuration = new static;

        if (false !== ($clientConfiguration = unserialize($config['watched_files']))) {
            $configuration->set($clientConfiguration);
        }

        return $configuration;
    }
952735
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = $this->getConfigurationInstance();
        if ($configuration) {
            $container->addObjectResource($configuration);
        }

        return $configuration;
    }
464831
public function client(array $config)
    {
        $key = $this->getClientKey($config);

        if (isset($this->clients[$key])) {
            return $this->clients[$key];
        }

        return $this->clients[$key] = $this->createClient($config);
    }
1159831
protected function getReadConfig( array $config )
	{
		$readConfig = $this->getReadWriteConfig( $config, 'read' );

		if ( isset( $readConfig['host'] ) && is_array( $readConfig['host'] ) )
			$readConfig['host'] = count( $readConfig['host'] ) > 1 ? $readConfig['host'][array_rand( $readConfig['host'] )] : $readConfig['host'][0];

		return $this->mergeReadWriteConfig( $config, $readConfig );
	}
241461
private function buildClient(array $config)
    {
        $client = ClientBuilder::create()
            ->setHosts($config['hosts']);

        if (isset($config['retries'])) {
            $client->setRetries($config['retries']);
        }

        if (isset($config['logging']) and $config['logging']['enabled'] == true) {
            $logger = ClientBuilder::defaultLogger($config['logging']['path'], $config['logging']['level']);
            $client->setLogger($logger);
        }

        return $client->build();
    }
816044
protected function getOptionsFromConfig(Config $config)
    {
        $options = $this->options;
        foreach (static::$mappingOptions as $option => $ossOption) {
            if (! $config->has($option)) {
                continue;
            }
            $options[$ossOption] = $config->get($option);
        }

        return $options;
    }
1152799
protected function getDefaultOptions($config)
    {
        $defaultOptions = (
            isset($config['defaults']) &&
            is_array($config['defaults']) &&
            isset($config['defaults']['options']) &&
            is_array($config['defaults']['options'])
        )
            ? $config['defaults']['options']
            : [];

        return $defaultOptions;
    }
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;
    }
751413
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = new Configuration($this->getMainConfigParser(), $this->suggestionCollector);
        $configuration->setSiteAccessConfigurationFilters($this->siteaccessConfigurationFilters);

        return $configuration;
    }
1274946
public static function client($config)
    {
        $defaults = [
            'path' => ''
        ];
        $config += $defaults;
        $client = new S3Client([
            'credentials' => [
                'key' => $config['username'],
                'secret' => $config['password'],
            ],
            'region' => $config['region'],
            'version' => $config['version'],
        ]);

        return new AwsS3Adapter($client, $config['host'], $config['path']);
    }
717084
protected function resolveConfig(array $config = array())
    {
        $resolver = new OptionsResolver;
        $this->setDefaultConfig($resolver);

        if (!empty($this->config)) {
            $resolver->setDefaults($this->config);
        }

        return $resolver->resolve($config);
    }
766770
private function getOptions(array $config = []): array
    {
        $resolver = new OptionsResolver();

        $resolver->setDefaults([
            'timeout' => 5,
            'verify_peer' => true,
            'verify_host' => 2,
            'proxy' => null,
        ]);

        $resolver->setAllowedTypes('timeout', 'int');
        $resolver->setAllowedTypes('verify_peer', 'bool');
        $resolver->setAllowedTypes('verify_host', 'int');
        $resolver->setAllowedTypes('proxy', ['string', 'null']);

        return $resolver->resolve($config);
    }
1208451
public function make(array $config): SearchClient
    {
        $config = $this->getConfig($config);

        return $this->getClient($config);
    }
919402
public static function factory($config = array())
    {
        $configuration = static::buildConfig($config);

        $client = new self($configuration->get('base_url'), $configuration);

        $client->addSubscriber(new KeyAuthPlugin($configuration->get('key')));

        static::loadDefinitions($client);
        static::toggleRateLimitingPlugin($client, $config);

        return $client;
    }
1241408
protected function doConnect($config)
    {
        $connectionString = "mysql:dbname={$config['database']}";
        
        if (isset($config['host'])) {
            $connectionString .= ";host={$config['host']}";
        }
        
        if (isset($config['port'])) {
            $connectionString .= ";port={$config['port']}";
        }

        if (isset($config['unix_socket'])) {
            $connectionString .= ";unix_socket={$config['unix_socket']}";
        }

        $connection = $this->container->build(
            '\PDO',
            array($connectionString, $config['username'], $config['password'], $config['options'])
        );

        if (isset($config['charset'])) {
            $connection->prepare("SET NAMES '{$config['charset']}'")->execute();
        }

        return $connection;
    }
71202
public static function get($config = array()) {
        $hash = md5(serialize($config));
        if (!isset(self::$_instances[$hash]))
            self::$_instances[$hash] = new static($config);
        return self::$_instances[$hash];
    }