Renamed DataStore to DataStoreInterface

Also, the Interface now contains comments on the expected return values.
This commit is contained in:
Jacob Kiers 2013-02-08 10:37:21 +00:00
parent 204ec8b42f
commit c471cd2b8d
2 changed files with 14 additions and 4 deletions

View File

@ -18,12 +18,14 @@ namespace JacobKiers\OAuth;
* @package OAuth * @package OAuth
* @author Gary Jones <gary@garyjones.co.uk> * @author Gary Jones <gary@garyjones.co.uk>
*/ */
interface DataStore interface DataStoreInterface
{ {
/** /**
* Validate the client. * Validate the client.
* *
* @param string $client_key * @param string $client_key
*
* @return JacobKiers\OAuth\Client
*/ */
public function lookupClient($client_key); public function lookupClient($client_key);
@ -33,6 +35,8 @@ interface DataStore
* @param JacobKiers\OAuth\Client $client * @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token * @param JacobKiers\OAuth\Token $token
* @param string $token_type Request or access token * @param string $token_type Request or access token
*
* @return JacobKiers\OAuth\Token
*/ */
public function lookupToken(Client $client, Token $token, $token_type); public function lookupToken(Client $client, Token $token, $token_type);
@ -43,6 +47,8 @@ interface DataStore
* @param JacobKiers\OAuth\Token $token * @param JacobKiers\OAuth\Token $token
* @param string $nonce * @param string $nonce
* @param int $timestamp * @param int $timestamp
*
* @return boolean
*/ */
public function lookupNonce(Client $client, Token $token, $nonce, $timestamp); public function lookupNonce(Client $client, Token $token, $nonce, $timestamp);
@ -51,6 +57,8 @@ interface DataStore
* *
* @param JacobKiers\OAuth\Client $client * @param JacobKiers\OAuth\Client $client
* @param string $callback URI to store as the post-authorization callback. * @param string $callback URI to store as the post-authorization callback.
*
* @return JacobKiers\OAuth\Token
*/ */
public function newRequestToken(Client $client, $callback = null); public function newRequestToken(Client $client, $callback = null);
@ -63,6 +71,8 @@ interface DataStore
* @param JacobKiers\OAuth\Client $client * @param JacobKiers\OAuth\Client $client
* @param JacobKiers\OAuth\Token $token * @param JacobKiers\OAuth\Token $token
* @param string $verifier * @param string $verifier
*
* @return JacobKiers\OAuth\Token
*/ */
public function newAccessToken(Client $client, Token $token, $verifier = null); public function newAccessToken(Client $client, Token $token, $verifier = null);
} }

View File

@ -45,16 +45,16 @@ class Server
/** /**
* Data store object reference. * Data store object reference.
* *
* @var JacobKiers\OAuth\DataStore * @var JacobKiers\OAuth\DataStoreInterface
*/ */
protected $data_store; protected $data_store;
/** /**
* Construct OAuth server instance. * Construct OAuth server instance.
* *
* @param JacobKiers\OAuth\DataStore $data_store * @param JacobKiers\OAuth\DataStoreInterface $data_store
*/ */
public function __construct(DataStore $data_store) public function __construct(DataStoreInterface $data_store)
{ {
$this->data_store = $data_store; $this->data_store = $data_store;
} }