public static function load(array $config)
{
if (!isset($config['adapter']) || empty($config['adapter']) || !is_string($config['adapter'])) {
throw new Exception("A database 'adapter' option is required and must be a nonempty string.");
}
$namespace = __NAMESPACE__ . '\\' . 'Pdo' . '\\';
$adapter = ucfirst(strtolower($config['adapter']));
$className = $namespace . $adapter;
if (!class_exists($className)) {
throw new Exception("Database adapter {$adapter} is not supported");
}
unset($config['adapter']);
return new $className($config);
}