From fce57a4e6eea2c3ac200b2860acb6a258d0624db Mon Sep 17 00:00:00 2001 From: GaryJones Date: Thu, 22 Nov 2012 17:37:12 +0000 Subject: [PATCH] Add new NullToken, to satisfy type hint checks when token would otherwise not be set. --- src/GaryJones/OAuth/NullToken.php | 35 +++++++++++++++++++++++++++++++ src/GaryJones/OAuth/Server.php | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/GaryJones/OAuth/NullToken.php diff --git a/src/GaryJones/OAuth/NullToken.php b/src/GaryJones/OAuth/NullToken.php new file mode 100644 index 0000000..b158bcc --- /dev/null +++ b/src/GaryJones/OAuth/NullToken.php @@ -0,0 +1,35 @@ + + * @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT + * @link https://github.com/GaryJones/OAuth + */ + +namespace GaryJones\OAuth; + +/** + * Token holds the properties of a single token. + * + * This class deals with both temporary (request) and token (access) credntials. + * + * @package OAuth + * @author Gary Jones + */ +class NullToken extends Token +{ + /** + * Constructs a new client object and populates the required parameters. + * + * @param string $key Client key / identifier. + * @param string $secret Client shared-secret. + */ + public function __construct() + { + $this->setKey(''); + $this->setSecret(''); + } +} diff --git a/src/GaryJones/OAuth/Server.php b/src/GaryJones/OAuth/Server.php index 7ed4ea3..f727057 100644 --- a/src/GaryJones/OAuth/Server.php +++ b/src/GaryJones/OAuth/Server.php @@ -88,7 +88,7 @@ class Server $client = $this->getClient($request); // no token required for the initial token request - $token = null; + $token = new NullToken; $this->checkSignature($request, $client, $token);