<commit_before><?php 

namespace Qik\Database;

use Qik\Utility\Utility;
use Qik\Exceptions\Internal\{DBManagerMissingConnection};

class DBManager
{
	private static $tablePrefix;
	private static $connections = [];

	public static function CreateConnection(string $host = null, string $user = null, string $password = null, string $db = null, string $type = 'mysql') 
	{
		try {
			$connection = new DBConnection($host, $user, $password, $db, $type);
			self::$connections[$db] = $connection;

			return $connection;
		} catch (DBConnectException $ex) {
			throw $ex;
		}
	}

	public static function GetConnection($db = null)
	{
		if ((!$db || empty($db)) && count(self::$connections) == 1)
			return array_pop(self::$connections);

		if (!isset(self::$connections[$db]))
			throw new DBManagerMissingConnection('Database manager missing connection for database '.($db ?? '(NONE)'));

		return self::$connections[$db];
	}

	public static function SetDefaultTablePrefix($prefix = null)
	{
		return self::$tablePrefix = $prefix;
	}

	public static function GetDefaultTablePrefix()
	{
		return self::$tablePrefix;
	}
}<commit_msg>working on db connection<commit_after><?php 

namespace Qik\Database;

use Qik\Utility\Utility;
use Qik\Exceptions\Internal\{DbManagerMissingConnection};

class DBManager
{
	private static $tablePrefix;
	private static $connections = [];

	public static function CreateConnection(string $host = null, string $user = null, string $password = null, string $db = null, string $type = 'mysql') 
	{
		try {
			$connection = new DBConnection($host, $user, $password, $db, $type);
			self::$connections[$db] = $connection;

			return $connection;
		} catch (DBConnectException $ex) {
			throw $ex;
		}
	}

	public static function GetConnection($db = null)
	{
		if ((!$db || empty($db)) && count(self::$connections) == 1)
			return array_pop(self::$connections);

		if (!isset(self::$connections[$db]))
			throw new DBManagerMissingConnection('Database manager missing connection for database '.($db ?? '(NONE)'));

		return self::$connections[$db];
	}

	public static function SetDefaultTablePrefix($prefix = null)
	{
		return self::$tablePrefix = $prefix;
	}

	public static function GetDefaultTablePrefix()
	{
		return self::$tablePrefix;
	}
}
{'fraction_non_alphanumeric': 0.14481236203090508, 'fraction_numerical': 0.0008830022075055188, 'mean_word_length': 5.026595744680851, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7430578', 'n_tokens_mistral': 734, 'n_tokens_neox': 680, 'n_words': 183}