mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 17:56:14 +05:30
Fixes and cleanup
Signed-off-by: Alex Bilbie <alex@alexbilbie.com>
This commit is contained in:
parent
ec191cffe1
commit
bef7a212e3
@ -1,43 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Oauth2\Client;
|
||||
namespace OAuth2\Client;
|
||||
|
||||
include('Exception.php');
|
||||
include('Token.php');
|
||||
include('IDP.php');
|
||||
include_once('Exception.php');
|
||||
|
||||
/**
|
||||
* OAuth2.0
|
||||
*
|
||||
* @author Phil Sturgeon < @philsturgeon >
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Oauth2\Client;
|
||||
namespace OAuth2\Client;
|
||||
|
||||
class Exception extends \Exception
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user