Add new NullToken, to satisfy type hint checks when token would otherwise not be set.

This commit is contained in:
GaryJones 2012-11-22 17:37:12 +00:00
parent af1993ac3a
commit fce57a4e6e
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,35 @@
<?php
/**
* OAuth
*
* @package OAuth
* @author Andy Smith
* @author Gary Jones <gary@garyjones.co.uk>
* @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 <gary@garyjones.co.uk>
*/
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('');
}
}

View File

@ -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);