Adds connection config

@param  string     $name
@param  array      $config

@throws RuntimeException

@return void
483647
public function addConfiguration($name, array $config)
    {
        if(array_key_exists($name, $this->configs)) {
            throw new \RuntimeException(
                "Connection with given name already exists!"
            );
        }

        $this->configs[$name] = $config;
    }
78976
public function addConnection(array $config, $name = 'default')
    {
        $this->connectionResolver->addConnection(
            $this->make($config),
            $name
        );

        return $this;
    }
527614
public function attachPort(string $name, $config): void
    {
        if (isset($this->attachedNames[strtolower($name)])) {
            throw new \InvalidArgumentException("The add listen port server [$name] has been exists!");
        }

        if (\is_array($config)) {
            $class = Arr::remove($config, 'listener');

            if (!$class) {
                throw new \InvalidArgumentException("Please setting the 'listener' class for the port server: $name");
            }

            $cb = new $class($config);

            if (!$cb instanceof PortListenerInterface) {
                throw new \InvalidArgumentException(
                    'The event handler must implement of ' . PortListenerInterface::class
                );
            }
        } elseif ($config instanceof \Closure || $config instanceof PortListenerInterface) {
            $cb = $config;

        } else {
            throw new \InvalidArgumentException('The 2th argument type only allow [array|\Closure|InterfacePortListener].');
        }

        $this->attachedNames[$name]     = true;
        $this->attachedListeners[$name] = $cb;
    }
1059455
public static function set($name, $driver, array $config = [])
    {
        self::$connections[$name] = new Connection($name, $driver, $config);
    }
412401
public function addRuntimeConfig($config) {
        if ( ! $config instanceof IConfig && ! is_array($config)) {
            throw new InvalidRuntimeConfigException(s(
                'Runtime config must be either an array or an ' .
                'instance of IConfig, got "%s".',
                get_type($config)
            ));
        }

        if ($config instanceof IConfig) {
            $config = $config->toArray();
        }

        $this->runtimeConfigs[] = $config;

        return $this;
    }
203703
public static function create(array $config, $name = 'default')
    {
        // Make sure a connection with same name doesn't exist
        if (array_key_exists($name, static::$connections)) {
            throw new Exception("Database connection {$name} already exists.");
        }

        // Set the class name, with the namespace
        $className = '\Radium\Database\\'. $config['driver'];

        // Connect to the database and return the object
        static::$connections[$name] = new $className($config, $name);
        return static::$connections[$name];
    }
789554
protected function connect($configs = null): void
    {
        if ($configs !== null) {
            $this->configs = array_replace($this->configs, $configs);
        }

        $dsn = "{$this->configs['type']}:dbname={$this->configs['name']};host="
            . $this->configs['host'];
        try {
            $this->connection = new PDO(
                $dsn,
                $this->configs['user'],
                $this->configs['pass']
            );
            $this->connection->setAttribute(
                PDO::ATTR_ERRMODE,
                $this->configs['error_mode']
            );
        } catch (PDOException $e) {
            throw new CoreException(
                __CLASS__.'::__construct()->PDO::__construct() : ' . $e->getMessage()
            );
        }
    }
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;
    }
381014
public function connect(array $config){
		Connection::alias($config, 'resource', 'pdo');

		// Defaults
		$defaults = array(
			'dsn' => null,
			'resource' => null,
			'username' => null,
			'password' => null,
			'options' => array(),
		);

		$config += $defaults;

		// Connect
		if($config['resource'] instanceof PDO)
			$this->resource = $config['resource'];
		else try{
			$this->resource = new PDO($config['dsn'], $config['username'], $config['password'], $config['options']);
		} catch(PDOException $e){
			throw new DriverException($e->getMessage(), $e->getCode());
		}

		if(!$this->resource)
			throw new DriverException('Connection failed.');

		$this->driverName = $this->resource->getAttribute(PDO::ATTR_DRIVER_NAME);
	}
1065947
protected function addConnection($name, array $parameters = [], array $envParameters = [])
    {
        $connectionParameterBag = new ParameterBag($envParameters);
        $connectionParameterBag->add($parameters);
        $connectionParameterBag->resolve();
        $this->connections[$name] = $connectionParameterBag;
    }
2919
public function loadConfigs(...$names)
    {
        /** @var Config $config */
        $config = $this->make(Config::class);
        foreach ($names as $name) {
            $config->load($name);
        }
    }
508892
public function addConfig($config) {
        if (is_array($config)) {
            // array of paths to config files
            if (array_is_indexed($config)) {
                $this->addPaths($config);
            }
            // array of key value configs
            else {
                $this->addRuntimeConfig($config);
            }
        }
        // path to config file
        else if (is_string($config)) {
            $this->addPath($config);
        }
        // config object
        else if ($config instanceof IConfig) {
            $this->addRuntimeConfig($config);
        }

        return $this;
    }
74724
public function install($config, $name) {
		$config['class'] = self::INSTALL_DIR . $name;
		return ScenarioHelper::run($config);
	}
881412
public function helper($name, array $config = []) {
		if (isset($this->_helpers[$name])) {
			return $this->_helpers[$name];
		}
		try {
			$config += ['context' => $this];
			return $this->_helpers[$name] = Libraries::instance('helper', ucfirst($name), $config);
		} catch (ClassNotFoundException $e) {
			if (ob_get_length()) {
				ob_end_clean();
			}
			throw new RuntimeException("Helper `{$name}` not found.");
		}
	}
1041388
public function prependExtensionConfig($name, array $config)
    {
        if (!isset($this->extensionConfigs[$name])) {
            $this->extensionConfigs[$name] = [];
        }

        array_unshift($this->extensionConfigs[$name], $config);
    }
228366
public function make($config, $name = null)
    {
        $config = $this->parseConfig($config, $name);

//        if (isset($config['read'])) {
//            return $this->createReadWriteConnection($config);
//        }
        return $this->createSingleConnection($config);
    }
1287686
public function mergeExtension($name, array $config)
    {
        $this->addExtension($name, array_merge(
            $this->getExtension($name),
            $config
        ));
    }