core-bundle/src/Resources/contao/library/Contao/Database.php
public static function getInstance(array $arrCustomConfig=null)
	{
		$arrConfig = array();

		if (\is_array($arrCustomConfig))
		{
			$arrDefaultConfig = array
			(
				'dbHost'     => Config::get('dbHost'),
				'dbPort'     => Config::get('dbPort'),
				'dbUser'     => Config::get('dbUser'),
				'dbPass'     => Config::get('dbPass'),
				'dbDatabase' => Config::get('dbDatabase')
			);

			$arrConfig = array_merge($arrDefaultConfig, $arrCustomConfig);
		}

		// Sort the array before generating the key
		ksort($arrConfig);
		$strKey = md5(implode('', $arrConfig));

		if (!isset(static::$arrInstances[$strKey]))
		{
			static::$arrInstances[$strKey] = new static($arrConfig);
		}

		return static::$arrInstances[$strKey];
	}
public static function getInstance(array $arrCustomConfig=null)
	{
		$arrConfig = array();

		if (\is_array($arrCustomConfig))
		{
			$arrDefaultConfig = array
			(
				'dbHost'     => Config::get('dbHost'),
				'dbPort'     => Config::get('dbPort'),
				'dbUser'     => Config::get('dbUser'),
				'dbPass'     => Config::get('dbPass'),
				'dbDatabase' => Config::get('dbDatabase')
			);

			$arrConfig = array_merge($arrDefaultConfig, $arrCustomConfig);
		}

		// Sort the array before generating the key
		ksort($arrConfig);
		$strKey = md5(implode('', $arrConfig));

		if (!isset(static::$arrInstances[$strKey]))
		{
			static::$arrInstances[$strKey] = new static($arrConfig);
		}

		return static::$arrInstances[$strKey];
	}
Instantiate the Database object (Factory)

@param array $arrCustomConfig A configuration array

@return Database The Database object