Фабрика классов


class ClassGenerator
{
    public static function factory($type)
    {
        if (include_once 'Driver/' . $type . '.php') {
            $classname = 'Driver_' . $type;
            return new $classname;
        } else {
            throw new Exception ('Driver not found');
        }
    }
}

$mysql = ClassGenerator::factory('MySQL');