Test if provider config exists

This commit is contained in:
Alex Bilbie 2012-09-04 12:40:32 +01:00
parent ed6301a497
commit 17b7bf7d1d

View File

@ -25,7 +25,17 @@ class Provider
{ {
$name = ucfirst(strtolower($name)); $name = ucfirst(strtolower($name));
require_once 'Provider/'.$name.'.php'; $fileName = 'Provider/'.$name.'.php';
if (file_exists($fileName)) {
require_once $fileName;
} else {
throw new Exception('There is no provider configuration file for '.$name);
}
return new $name($options); return new $name($options);
} }