1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 16:44:30 +02:00

all file names correspond with class name

This commit is contained in:
David Grudl
2013-06-22 16:54:51 +02:00
parent d01ede6aee
commit 1382a1021f
18 changed files with 381 additions and 381 deletions

View File

@@ -89,10 +89,10 @@ class DibiConnection extends DibiObject
$config['driver'] = dibi::$defaultDriver;
}
$driver = preg_replace('#[^a-z0-9_]#', '_', strtolower($config['driver']));
$class = "Dibi" . $driver . "Driver";
$class = preg_replace(array('#\W#', '#sql#'), array('_', 'Sql'), ucfirst(strtolower($config['driver'])));
$class = "Dibi{$class}Driver";
if (!class_exists($class, FALSE)) {
include_once dirname(__FILE__) . "/../drivers/$driver.php";
include_once dirname(__FILE__) . "/../drivers/$class.php";
if (!class_exists($class, FALSE)) {
throw new DibiException("Unable to create instance of dibi driver '$class'.");