diff --git a/src/Oauth2/Client/Client.php b/src/Oauth2/Client/Client.php index d3fffe23..8a14c050 100755 --- a/src/Oauth2/Client/Client.php +++ b/src/Oauth2/Client/Client.php @@ -1,43 +1,19 @@ - */ -class Provider +class Client { - - /** - * Create a new provider client. - * - * @param string provider name - * @param array provider options - * @return OAuth_Provider - */ - public function __construct($name, array $options = NULL) + public function __construct($name, array $options = null) { - $name = ucfirst(strtolower($name)); + if ( ! class_exists($name)) { - $fileName = 'Provider/'.$name.'.php'; - - if (file_exists($fileName)) { - - require_once $fileName; - - } else { - - throw new Exception('There is no provider configuration file for '.$name); + throw new OAuth2\Client\Exception('There is no identity provider called: '.$name); } return new $name($options); } - } \ No newline at end of file diff --git a/src/Oauth2/Client/Exception.php b/src/Oauth2/Client/Exception.php index e21d8060..adadac61 100644 --- a/src/Oauth2/Client/Exception.php +++ b/src/Oauth2/Client/Exception.php @@ -1,6 +1,6 @@