Get the cache client.

@param string[] $config

@return \League\Flysystem\AdapterInterface
550899
protected function getClient(array $config)
    {
        $name = array_get($config, 'adapter');
        $config = $this->manager->getConnectionConfig($name);

        return $this->manager->getFactory()->createAdapter($config);
    }
84794
private function getInstanceHelper($config)
    {
        if (is_callable($config)) {
            return $config;
        }
        if (!isset($config['class_name'])) {
            throw new Exception\RuntimeException('Config router convert miss "class_name"');
        }
        $className = $config['class_name'];
        if (!class_exists($className)) {
            throw new Exception\RuntimeException(sprintf('"%s" is not existed', $className));
        }

        /**
         * @todo User can config parameter when create new object
         * @todo User can config call method after creating object
         */
        $object = new $className;

        return $object;
    }
870154
public static function factory(array $config)
    {
        if ( ! array_key_exists('apiKey', $config)) {
            throw new \Exception('Api factory requires $apiKey parameter.');
        }

        $client = new Client([
            'defaults' => [
                'headers' => [
                    'X-ApiKey' => $config['apiKey'],
                ],
            ],
        ], [], $config);

        $description = self::getDescriptionFromConfig($config);

        $apiVersion = isset($config['apiVersion']) ? $config['apiVersion'] : 1;

        return new self($client, $description, ['defaults' => ['api_version' => $apiVersion]]);
    }
190699
protected function createCacheStore($config)
    {
        if ($config === true) {
            return new MemoryStore;
        }

        return new Cache(
            $this->app['cache']->store($config['store']),
            array_get($config, 'prefix', 'flysystem'),
            array_get($config, 'expire')
        );
    }
428828
public static function factory($config = array())
    {
        $defaults = array();

        $required = array(
            'base_url',
            'login',
            'password'
        );

        $config = Collection::fromConfig($config, $defaults, $required);

        $client = new self($config['base_url'], $config);

        return $client;
    }
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']);
    }
117558
public static function get(array $config)
    {
        if (!isset($config['driver']) || !$config['driver']) {
            throw new \RuntimeException('no driver specified');
        }

        $driver = strtolower($config['driver']);

        if (!in_array($driver, array('sqlite', 'mysql', 'sqlserver', 'postgre'), true)) {
            throw new \UnexpectedValueException('PDO driver "' . $driver . '" not supported by PIMF');
        }

        if (!extension_loaded('pdo') || !extension_loaded('pdo_' . $driver)) {
            throw new \RuntimeException('Please navigate to "http://php.net/manual/pdo.installation.php" '
                . ' to find out how to install "PDO" with "pdo_' . $driver . '" on your system!');
        }

        $driver = '\Pimf\Pdo\\' . ucfirst($driver);

        $pdo = new $driver();

        return $pdo->connect($config);
    }
1145643
private function getCacheInstance(array $config)
    {
        if (!isset($config['enable']) || !$config['enable']) {
            return null;
        }

        $className = $config['adapter'];
        if (!class_exists($className)) {
            $errMsg = sprintf('Adapter "%s" is not supported for caching', $config['adapter']);
            throw new Exception\RuntimeException($errMsg);
        }
        return new $className($config['options']);
    }
485980
public static function get($config = null) {
		if (!isset($config['driver'])) {
			throw new ConnectionException("Unknown driver");
		}
		if (!isset($config['host']) || !isset($config['port'])) {
			throw new ConnectionException("Host and Port is required");
		}
		$type = $config['driver'];
		$hash = md5($type . ':' . $config['host'] . ':' . $config['port']);
		if (!isset(self::$created_driver[$hash])) {
			if (isset(self::$driver[$type])) {
				$className = self::$driver[$type];
			} else {
				$className = __NAMESPACE__ . '\\Driver\\' . ucfirst($type);
			}
			self::$created_driver[$hash] = new $className($config);
		}
		return self::$created_driver[$hash];
	}
789659
public static function getInstance(array $config = array(), DriverInterface $driver = null)
    {
        static $instance = null;

        if (null === $instance) {
            $instance = new static();
        }

        if ($config) {
            $instance->config = $config;
        }

        if ($driver) {
            $instance->driver = $driver;
        }

        return $instance;
    }
47208
public static function getInstance($Config)
    {
        if (!self::$Instance) {
            self::$Instance = CacheFactory::factory($Config);
        }
        return self::$Instance;
    }
814036
protected function makeBaseClient($config)
    {
        $parameters = $this->getParameters($config);

        $client = new Client($parameters);

        $this->attachSubscribers($client);

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

        return $this->getAdapter($client);
    }
965729
protected function getClient(array $config): Client
    {
        $client = Client::create($config['url']);

        $client->authenticate(
            $config['token'],
            array_get($config, 'method', Client::AUTH_URL_TOKEN),
            array_get($config, 'sudo', null)
        );

        return $client;
    }
726947
protected function normalizeClientConfig(array $config)
    {
        if (! isset($config['client'])) {
            $config['client'] = ['url' => $config['url']];
        } elseif (is_string($config['client'])) {
            $client = Arr::get($this->config, 'clients.'.$config['client']);

            if ($client == null) {
                throw new InvalidArgumentException('Client '.$config['client'].' doesn\'t configured.');
            }

            $config['client'] = $client;
        }

        return $config;
    }
1282443
public static function get($config = []) {
        $key = md5(get_called_class() . serialize($config));
        if (!isset(self::$_instances[$key]))
            self::$_instances[$key] = new static($config);
        return self::$_instances[$key];
    }
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;
    }