get_platform_database_options()); if ($signature == $default_signature) { $driver = Platform::getInstance()->get_default_database_driver(true); } else { $driver = Platform::getInstance()->get_default_database_driver(false); } } else { // Make sure a full driver name was given if ((substr($driver, 0, 7) != '\\Akeeba') && substr($driver, 0, 7) != 'Akeeba\\') { $driver = '\\Akeeba\\Engine\\Driver\\' . ucfirst($driver); } } self::$instances[$signature] = new $driver($options); } return self::$instances[$signature]; } public static function unsetDatabase($options) { self::getDatabase($options, true); } /** * Forces a specific instance. This is supposed to be used only in Unit Tests. * * @param $key * @param $instance * * @throws \Exception */ public static function forceInstance($key, $instance) { if (!interface_exists('PHPUnit_Exception', false)) { $method = __METHOD__; throw new \Exception("You can only use $method in Unit Tests", 500); } self::$instances[$key] = $instance; } /** * Reset all the instances. This is supposed to be used only in Unit Tests. * * @throws \Exception */ public static function nukeInstances() { if (!interface_exists('PHPUnit_Exception', false)) { $method = __METHOD__; throw new \Exception("You can only use $method in Unit Tests", 500); } self::$instances = array(); } }