@param Config $config

@return DB
341189
public static function getDbInstance(Config $config) {
            $handle = self::getDbHandle($config);
            if (!isset(self::$pool[ $handle ])) {
                self::$pool[ $handle ] = new DB($config);
            }

            return self::$pool[ $handle ];
        }
211340
public function setConfig(Config $config)
    {
        parent::setConfig($config);

        foreach ($this->sequence as $command) {
            $command->setConfig($config);
        }

        return $this;
    }
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)
        );
    }
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;
    }
47208
public static function getInstance($Config)
    {
        if (!self::$Instance) {
            self::$Instance = CacheFactory::factory($Config);
        }
        return self::$Instance;
    }
361861
public static function factory($config)
    {
        // get session storage driver
        $storage = $config->get('session_storage', 'db');

        // class name for this storage
        $class = "rcube_session_" . $storage;

        // try to instantiate class
        if (class_exists($class)) {
            return new $class($config);
        }

        // no storage found, raise error
        rcube::raise_error(array('code' => 604, 'type' => 'session',
                               'line' => __LINE__, 'file' => __FILE__,
                               'message' => "Failed to find session driver. Check session_storage config option"),
                           true, true);
    }
1067897
public function setConfig(Config $config)
    {
        $this->checkConfigConsistency($config);

        $this->config = $config;

        return $this;
    }
22096
public static function instance($name = 'default', array $config = array())
    {
        if ( ! isset(self::$instances[$name])) {
            if (empty($config)) {
                // Load the configuration for this database
                $config = self::config($name);
            }

            self::$instances[$name] = new self($name, $config);
        }

        return self::$instances[$name];
    }
23763
public function setConfig(Config $config)
    {
        $this->config = $this->server->setConfig($config);

        return $this;
    }
739109
protected function getDblibDsn(array $config)
    {
        return $this->buildConnectString('dblib', array_merge([
            'host' => $this->buildHostString($config, ':'),
            'dbname' => $config['database'],
        ], Arr::only($config, ['appname', 'charset', 'version'])));
    }
1309784
public static function getDbo($config = array(), $cname = '')
	{
		// empty instance of db
		$db = App::get('db');

		// make sure we have a group object
		if (!$group = Group::getInstance(\Request::getString('cn', $cname)))
		{
			return $db;
		}

		// make sure we are a super group
		if (!$group->isSuperGroup())
		{
			return $db;
		}

		// load super group db config if not passed in
		if (empty($config))
		{
			// build path to config file
			$uploadPath = \Component::params( 'com_groups' )->get('uploadpath');
			$configPath = PATH_APP . DS . trim($uploadPath, DS) . DS . $group->get('gidNumber') . DS . 'config' . DS . 'db.php';

			// make sure file exists
			if (!file_exists($configPath))
			{
				return $db;
			}

			// include config
			$config = include $configPath;
		}

		// return instance of db
		return \Hubzero\Database\Driver::getInstance($config);
	}
1105284
protected function loadExtensions(Config $config)
    {
        $uses = $config->get('uses', []);

        foreach ($uses as $use => $useSettings) {
            $this->loadExtension($use, $useSettings, $config);
        }

        return $this;
    }
286101
public static function fromArray(array $config): EasyDB
    {

        /** @var string $dsn */
        $dsn      = $config[0];
        /** @var string|null $username */
        $username = $config[1] ?? null;
        /** @var string|null $password */
        $password = $config[2] ?? null;
        /** @var array $options */
        $options  = $config[3] ?? [];

        $dbEngine = '';
        $post_query = null;

        if (!\is_string($username)) {
            $username = '';
        }
        if (!\is_string($password)) {
            $password = '';
        }

        // Let's grab the DB engine
        if (strpos($dsn, ':') !== false) {
            $dbEngine = explode(':', $dsn)[0];
        }

        /** @var string $post_query */
        $post_query = '';

        // If no charset is specified, default to UTF-8
        switch ($dbEngine) {
            case 'mysql':
                if (\strpos($dsn, ';charset=') === false) {
                    $dsn .= ';charset=utf8mb4';
                }
                break;
            case 'pgsql':
                $post_query = "SET NAMES 'UNICODE'";
                break;
        }

        try {
            $pdo = new \PDO($dsn, $username, $password, $options);
        } catch (\PDOException $e) {
            if (\strpos((string) $e->getMessage(), 'could not find driver') !== false) {
                throw (new Issues\ConstructorFailed(
                    'Could not create a PDO connection. Is the driver installed/enabled?'
                ))->setRealException($e);
            }
            
            if (\strpos((string) $e->getMessage(), 'unknown database') !== false) {
                throw (new Issues\ConstructorFailed(
                    'Could not create a PDO connection. Check that your database exists.'
                ))->setRealException($e);
            }
            
            // Don't leak credentials directly if we can.
            throw (new Issues\ConstructorFailed(
                'Could not create a PDO connection. Please check your username and password.'
            ))->setRealException($e);
        }

        if (!empty($post_query)) {
            $pdo->query($post_query);
        }

        return new EasyDB($pdo, $dbEngine, $options);
    }
409175
private function getDblibDsn(array $config)
    {
        $arguments = [
            'host'   => $config['host'] . ':' . $config['port'],
            'dbname' => $config['database'],
        ];

        if (isset($config['appname'])) {
            $arguments['appname'] = $config['appname'];
        }

        if (isset($config['charset'])) {
            $arguments['charset'] = $config['charset'];
        }

        return $this->buildConnectString('dblib', $arguments);
    }
839395
protected function getHostDsn(array $config)
    {
        $dns = 'mysql:host=' . $config['host'] . ';dbname=' . $config['database'];
        if (isset($config['port']) && !empty($config['port'])) {
            $dns .= ';port=' . $config['port'];
        }
        return $dns;
    }
193351
public static function getInstance(Configuration $config = null)
    {
        if (!self::$instance) {
            self::$instance = new self($config);
        }

        return self::$instance;
    }