Retrieve configuration options by key, or as whole array.
@param string $key
@param string $conn_name Which connection to use or null for all connections
432488
public static function getConfig($key = null, $conn_name = self::DEFAULT_CONNECTION) {
        
        if( $key && is_null($conn_name) ) {
            
            //get key's value for each connection
            $conn_names = array_keys(static::$_config);
            $val_of_key_4_each_conn_name = array_column(static::$_config, $key);
            
            return array_combine($conn_names, $val_of_key_4_each_conn_name);
            
        } else if ( $key && !is_null($conn_name) && strlen($conn_name) > 0 ) {
            
            //get key's value for the specified connection
            return static::$_config[$conn_name][$key];
            
        } else if( !$key && is_null($conn_name) ) {
            
            //get all config values for all connections
            return static::$_config;
            
        } else {
            
            //get all config values for the specified connection
            return static::$_config[$conn_name];
        }
    }
44187
public static function useConnection($connection_name='', $db = null) {
        if(!$connection_name){
            $connection_name=Connection::class;
        }
        CoContext::getContext()->set(CoContext::CONNECTION_NAME, $connection_name);
        if ($db) {
            CoContext::getContext()->set(CoContext::CONNECTION_scheme, $db);
        }
    }
1229918
public function getConnectionConfig($name = null) {
		if (is_null($name)) {
			$name = $this->defaultConfigName;
		}

		if (isset($this->connectionConfigs[$name])) {
			return $this->connectionConfigs[$name];
		}

		return null;
	}
818926
public function getConnectionConfig($conn = null)
    {
        $conn = $conn ?: $this->getConnectionName();

        return $this->config->extract('queue.' . $conn);
    }
388761
public function getConfiguration($key = null)
	{
		if(is_null($key))
		{
			return $this->configuration + $this->core['configuration'];
		}

		$configuration = $this->configuration + $this->core['configuration'];

		if(array_key_exists($key, $configuration))
		{
			return $configuration[$key];
		}

		return null;
	}
282352
public function getConnection($connectionName = null)
    {
        /** @var Configuration $configuration */
        $configuration = $this->get('configuration');
        $connectionName = null !== $connectionName ?: $configuration['connection_name'];
        
        return $this->getConnectionManager()->getConnection($connectionName);
    }
1183810
private static function getConnectionConfiguration($name)
    {
        $databaseConfig = Configuration::get('database.connections');
        if (isset($databaseConfig[$name])) {
            $databaseConfig = $databaseConfig[$name];
        } else {
            $databaseConfig = null;
        }

        if ($databaseConfig === null) {
            throw new ConfigurationException("Database configuration for connection '" . $name . "' doesn't exists!");
        }

        if (! isset($databaseConfig['driver'])) {
            throw new ConfigurationException("Database configuration for connection '" . $name . "' is invalid!");
        }

        return $databaseConfig;
    }
391575
public static function connection($name = null)
    {
        if (is_null($name) || strlen($name) == 0) {
            if (is_null(static::$name)) {
                static::$name = static::$config['default'];
            }

            $name = static::$name;
        }

        if (!isset(static::$config['connection'][$name])) {
            throw new ConnectionException('The connection "' . $name . '" is not defined.');
        }

        if ($name !== static::$name) {
            static::$adapter = null;
        }

        $config = static::$config['connection'][$name];

        static::$name = $name;

        if (static::$adapter === null) {
            if ($name == 'mysql') {
                static::$adapter = new MysqlAdapter($config);
            } elseif ($name == 'sqlite') {
                static::$adapter = new SqliteAdapter($config);
            } else {
                throw new ConnectionException('This driver is not praised');
            }

            static::$adapter->setFetchMode(static::$config['fetch']);
        }

        if (static::$adapter->getConnection() instanceof PDO && $name == static::$name) {
            return static::getInstance();
        }

        return static::getInstance();
    }
848571
private static function instance($con_name, $config = [])
    {
        if (!isset(self::$instance[$con_name])) {
            self::$instance[$con_name] = Db::connect($config, $con_name);
        }
        return self::$instance[$con_name];
    }
816627
public function getConnection($name = null, $forceNew = false) {
		if (!$forceNew && isset($this->connections[$name])) {
			return $this->connections[$name];
		}

		$config = $this->getConnectionConfig($name);

		if (!$config) {
			return null;
		}

		$pdoArgs = [$config['dsn'], $config['username'], $config['password']];
		$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];

		if (isset($config['options'])) {
			$options = $config['options'] + $options;
		}
		$pdoArgs[] = $options;

		$this->connections[$name] = new PDO(...$pdoArgs);

		return $this->connections[$name];
	}
735075
public static function checkConnections($connection_name, $table, $check)
    {
        if($check === true)
        {
            $connections = DB::connection($connection_name)->table($table)->get();

            foreach($connections as $connection)
            {
                $name = $connection->name;

                try{
                    $testConnection = DB::connection($name)->getPdo();
                }catch(\Exception $e)
                {
                    $error = $e->getMessage();
                    \error_log($error);
                }
                if(!empty($testConnection) && empty($error))
                {
                    $update = DB::connection($connection_name)->table($table)->where('name', $name)->update(['status' => true]);
                }
                else
                {
                    $update = DB::connection($connection_name)->table($table)->where('name', $name)->update(['status' => false]);
                }
            }
        }
    }
472717
public function getConnection(string $name=null, array $params=[])
  {
    # Find the connection - null if it's not created
    $connection = $this->findConnection($name);

    if (\is_null($connection)) {
      # Create the connection
      $connection = $this->createConnection($name, $params);

      if (!\is_null($connection)) {
        $this->addConnection($connection);
      }
    }

    return $connection;
  }
125121
public function getConnection($name = 'default')
    {
        if (array_key_exists($name, $this->connections)) {
            return $this->connections[$name];
        }
        return null;
    }
414926
function &get_key($config_key)
	{
		list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
		$result = &$this->get($file_name, $section_name, $var_name);
		return $result;
	}
1072763
static function getParameter($connection_name, $key) {
		// don't reveal passwords through this interface
		if ('password' === $key) {
			throw new RuntimeException('DB::password is private');
		}

		if (!array_key_exists($connection_name, self::$parameters)) {
			throw new RuntimeException("Configuration for database '$connection_name' not loaded");
		}

		return @self::$parameters[$connection_name][$key];
	}
379486
public static function getConfigSetting($gateway, $key)
    {
        $config = self::config()->get($gateway);

        if (!is_array($config)) {
            return null;
        }

        return isset($config[$key]) ? $config[$key] : null;
    }
593096
public function get($key, $name = null)
    {
        if ($name) {
            return array_key_exists($name, $this->config[$key]) ? $this->config[$key][$name] : null;
        } else {
            return $this->has($key) ? $this->config[$key] : null;
        }
    }