From bef7a212e3713f0833560bbd41000d9cd2d1c2c4 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 5 Oct 2012 15:03:15 +0100 Subject: [PATCH] Fixes and cleanup Signed-off-by: Alex Bilbie --- src/Oauth2/Client/Client.php | 36 ++++++--------------------------- src/Oauth2/Client/Exception.php | 2 +- 2 files changed, 7 insertions(+), 31 deletions(-) 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 @@