From 782f43c73a6e7aa8ae3b0a9eca2770d1de460259 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 2 May 2014 15:14:12 +0100 Subject: [PATCH] Updated entity class names --- src/Storage/AccessTokenInterface.php | 36 +++++++++++++-------------- src/Storage/AuthCodeInterface.php | 2 +- src/Storage/ClientInterface.php | 10 ++++---- src/Storage/RefreshTokenInterface.php | 12 +++++---- src/Storage/ScopeInterface.php | 2 +- src/Storage/SessionInterface.php | 31 +++++++++++++---------- tests/Grant/AbstractGrantTest.php | 2 +- tests/Grant/AuthCodeTest.php | 6 ++--- tests/Grant/ClientCredentialsTest.php | 4 +-- tests/Grant/PasswordTest.php | 4 +-- tests/Grant/RefreshTokenTest.php | 8 +++--- tests/ResourceServerTest.php | 8 +++--- 12 files changed, 66 insertions(+), 59 deletions(-) diff --git a/src/Storage/AccessTokenInterface.php b/src/Storage/AccessTokenInterface.php index 482eb818..38ad4cbd 100644 --- a/src/Storage/AccessTokenInterface.php +++ b/src/Storage/AccessTokenInterface.php @@ -11,11 +11,11 @@ namespace League\OAuth2\Server\Storage; -use League\OAuth2\Server\Entity\AccessToken; -use League\OAuth2\Server\Entity\AbstractToken; -use League\OAuth2\Server\Entity\RefreshToken; -use League\OAuth2\Server\Entity\AuthCode; -use League\OAuth2\Server\Entity\Scope; +use League\OAuth2\Server\Entity\AccessTokenEntity; +use League\OAuth2\Server\Entity\AbstractTokenEntity; +use League\OAuth2\Server\Entity\RefreshTokenEntity; +use League\OAuth2\Server\Entity\AuthCodeEntity; +use League\OAuth2\Server\Entity\ScopeEntity; /** * Access token interface @@ -23,25 +23,25 @@ use League\OAuth2\Server\Entity\Scope; interface AccessTokenInterface { /** - * Get an instance of Entity\AccessToken + * Get an instance of Entity\AccessTokenEntity * @param string $token The access token - * @return \League\OAuth2\Server\Entity\AccessToken + * @return \League\OAuth2\Server\Entity\AccessTokenEntity */ public function get($token); /** * Get the access token associated with an access token - * @param \League\OAuth2\Server\Entity\RefreshToken $refreshToken - * @return \League\OAuth2\Server\Entity\AccessToken + * @param \League\OAuth2\Server\Entity\RefreshTokenEntity $refreshToken + * @return \League\OAuth2\Server\Entity\AccessTokenEntity */ - public function getByRefreshToken(RefreshToken $refreshToken); + public function getByRefreshToken(RefreshTokenEntity $refreshToken); /** * Get the scopes for an access token - * @param \League\OAuth2\Server\Entity\AbstractToken $token The access token - * @return array Array of \League\OAuth2\Server\Entity\Scope + * @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token + * @return array Array of \League\OAuth2\Server\Entity\ScopeEntity */ - public function getScopes(AbstractToken $token); + public function getScopes(AbstractTokenEntity $token); /** * Creates a new access token @@ -54,16 +54,16 @@ interface AccessTokenInterface /** * Associate a scope with an acess token - * @param \League\OAuth2\Server\Entity\AbstractToken $token The access token - * @param \League\OAuth2\Server\Entity\Scope $scope The scope + * @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token + * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope * @return void */ - public function associateScope(AbstractToken $token, Scope $scope); + public function associateScope(AbstractTokenEntity $token, ScopeEntity $scope); /** * Delete an access token - * @param \League\OAuth2\Server\Entity\AbstractToken $token The access token to delete + * @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token to delete * @return void */ - public function delete(AbstractToken $token); + public function delete(AbstractTokenEntity $token); } diff --git a/src/Storage/AuthCodeInterface.php b/src/Storage/AuthCodeInterface.php index aaf1898c..41da4e7f 100644 --- a/src/Storage/AuthCodeInterface.php +++ b/src/Storage/AuthCodeInterface.php @@ -19,7 +19,7 @@ interface AuthCodeInterface /** * Get the auth code * @param string $code - * @return \League\OAuth2\Server\Entity\AuthCode + * @return \League\OAuth2\Server\Entity\AuthCodeEntity */ public function get($code); } diff --git a/src/Storage/ClientInterface.php b/src/Storage/ClientInterface.php index 267888f0..00ede1ab 100644 --- a/src/Storage/ClientInterface.php +++ b/src/Storage/ClientInterface.php @@ -11,7 +11,7 @@ namespace League\OAuth2\Server\Storage; -use League\OAuth2\Server\Entity\Session; +use League\OAuth2\Server\Entity\SessionEntity; /** * Client storage interface @@ -24,14 +24,14 @@ interface ClientInterface * @param string $clientSecret The client's secret (default = "null") * @param string $redirectUri The client's redirect URI (default = "null") * @param string $grantType The grant type used in the request (default = "null") - * @return League\OAuth2\Server\Entity\Client + * @return League\OAuth2\Server\Entity\ClientEntity */ public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null); /** * Get the client associated with a session - * @param \League\OAuth2\Server\Entity\Session $session The session - * @return \League\OAuth2\Server\Entity\Client + * @param \League\OAuth2\Server\Entity\SessionEntity $session The session + * @return \League\OAuth2\Server\Entity\ClientEntity */ - public function getBySession(Session $session); + public function getBySession(SessionEntity $session); } diff --git a/src/Storage/RefreshTokenInterface.php b/src/Storage/RefreshTokenInterface.php index f87f8abd..42693c6f 100644 --- a/src/Storage/RefreshTokenInterface.php +++ b/src/Storage/RefreshTokenInterface.php @@ -11,15 +11,17 @@ namespace League\OAuth2\Server\Storage; +use League\OAuth2\Server\Entity\RefreshTokenEntity; + /** * Refresh token interface */ interface RefreshTokenInterface { /** - * Return a new instance of \League\OAuth2\Server\Entity\RefreshToken + * Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity * @param string $token - * @return \League\OAuth2\Server\Entity\RefreshToken + * @return \League\OAuth2\Server\Entity\RefreshTokenEntity */ public function get($token); @@ -28,14 +30,14 @@ interface RefreshTokenInterface * @param string $token * @param integer $expireTime * @param string $accessToken - * @return \League\OAuth2\Server\Entity\RefreshToken + * @return \League\OAuth2\Server\Entity\RefreshTokenEntity */ public function create($token, $expireTime, $accessToken); /** * Delete the refresh token - * @param string $token + * @param \League\OAuth2\Server\Entity\RefreshTokenEntity $token * @return void */ - public function delete($token); + public function delete(RefreshTokenEntity $token); } diff --git a/src/Storage/ScopeInterface.php b/src/Storage/ScopeInterface.php index 59bfcdd9..ffc87953 100644 --- a/src/Storage/ScopeInterface.php +++ b/src/Storage/ScopeInterface.php @@ -27,7 +27,7 @@ interface ScopeInterface * * @param string $scope The scope * @param string $grantType The grant type used in the request (default = "null") - * @return bool|array If the scope doesn't exist return false + * @return \League\OAuth2\Server\Entity\ScopeEntity */ public function get($scope, $grantType = null); } diff --git a/src/Storage/SessionInterface.php b/src/Storage/SessionInterface.php index 40f8873f..5e9fc965 100644 --- a/src/Storage/SessionInterface.php +++ b/src/Storage/SessionInterface.php @@ -11,6 +11,11 @@ namespace League\OAuth2\Server\Storage; +use League\OAuth2\Server\Entity\AccessTokenEntity; +use League\OAuth2\Server\Entity\AuthCodeEntity; +use League\OAuth2\Server\Entity\SessionEntity; +use League\OAuth2\Server\Entity\ScopeEntity; + /** * Session storage interface */ @@ -19,30 +24,30 @@ interface SessionInterface /** * Get a session from it's identifier * @param string $sessionId - * @return \League\OAuth2\Server\Entity\Session + * @return \League\OAuth2\Server\Entity\SessionEntity */ public function get($sessionId); /** * Get a session from an access token - * @param \League\OAuth2\Server\Entity\AccessToken $accessToken The access token - * @return \League\OAuth2\Server\Entity\Session + * @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token + * @return \League\OAuth2\Server\Entity\SessionEntity */ - public function getByAccessToken($accessToken); + public function getByAccessToken(AccessTokenEntity $accessToken); /** * Get a session from an auth code - * @param \League\OAuth2\Server\Entity\AuthCode $authCode The auth code - * @return \League\OAuth2\Server\Entity\Session + * @param \League\OAuth2\Server\Entity\AuthCodeEntity $authCode The auth code + * @return \League\OAuth2\Server\Entity\SessionEntity */ - public function getByAuthCode($authCode); + public function getByAuthCode(AuthCodeEntity $authCode); /** * Get a session's scopes - * @param integer $sessionId - * @return array Array of \League\OAuth2\Server\Entity\Scope + * @param \League\OAuth2\Server\Entity\SessionEntity + * @return array Array of \League\OAuth2\Server\Entity\ScopeEntity */ - public function getScopes($sessionId); + public function getScopes(SessionEntity $session); /** * Create a new session @@ -56,9 +61,9 @@ interface SessionInterface /** * Associate a scope with a session - * @param integer $sessionId - * @param string $scopeId The scopes ID might be an integer or string + * @param \League\OAuth2\Server\Entity\SessionEntity $scope The scope + * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope * @return void */ - public function associateScope($sessionId, $scopeId); + public function associateScope(SessionEntity $session, ScopeEntity $scope); } diff --git a/tests/Grant/AbstractGrantTest.php b/tests/Grant/AbstractGrantTest.php index 9d4d6523..351aec8b 100644 --- a/tests/Grant/AbstractGrantTest.php +++ b/tests/Grant/AbstractGrantTest.php @@ -3,7 +3,7 @@ namespace LeagueTests\Grant; use League\OAuth2\Server\Grant; -use League\OAuth2\Server\Entity\Scope; +use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\Exception\InvalidRequestException; use LeagueTests\Stubs\StubAbstractGrant; diff --git a/tests/Grant/AuthCodeTest.php b/tests/Grant/AuthCodeTest.php index eb15238c..2b0830b3 100644 --- a/tests/Grant/AuthCodeTest.php +++ b/tests/Grant/AuthCodeTest.php @@ -4,9 +4,9 @@ namespace LeagueTests\Grant; use League\OAuth2\Server\Grant\AuthCode; use League\OAuth2\Server\Grant\RefreshToken; -use League\OAuth2\Server\Entity\Scope; -use League\OAuth2\Server\Entity\Client; -use League\OAuth2\Server\Entity\Session; +use League\OAuth2\Server\Entity\ScopeEntity; +use League\OAuth2\Server\Entity\ClientEntity; +use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\AuthCode as AC; use League\OAuth2\Server\AuthorizationServer as Authorization; use League\OAuth2\Server\Exception\InvalidRequestException; diff --git a/tests/Grant/ClientCredentialsTest.php b/tests/Grant/ClientCredentialsTest.php index 1686c611..8ab2332f 100644 --- a/tests/Grant/ClientCredentialsTest.php +++ b/tests/Grant/ClientCredentialsTest.php @@ -3,8 +3,8 @@ namespace LeagueTests\Grant; use League\OAuth2\Server\Grant\ClientCredentials; -use League\OAuth2\Server\Entity\Scope; -use League\OAuth2\Server\Entity\Client; +use League\OAuth2\Server\Entity\ScopeEntity; +use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\AuthorizationServer as Authorization; use League\OAuth2\Server\Grant\ClientException; use Mockery as M; diff --git a/tests/Grant/PasswordTest.php b/tests/Grant/PasswordTest.php index 85110223..cb771e94 100644 --- a/tests/Grant/PasswordTest.php +++ b/tests/Grant/PasswordTest.php @@ -4,8 +4,8 @@ namespace LeagueTests\Grant; use League\OAuth2\Server\Grant\Password; use League\OAuth2\Server\Grant\RefreshToken; -use League\OAuth2\Server\Entity\Scope; -use League\OAuth2\Server\Entity\Client; +use League\OAuth2\Server\Entity\ScopeEntity; +use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\AuthorizationServer; use Mockery as M; diff --git a/tests/Grant/RefreshTokenTest.php b/tests/Grant/RefreshTokenTest.php index 539f0d8d..397ed7d5 100644 --- a/tests/Grant/RefreshTokenTest.php +++ b/tests/Grant/RefreshTokenTest.php @@ -3,10 +3,10 @@ namespace LeagueTests\Grant; use League\OAuth2\Server\Grant\RefreshToken; -use League\OAuth2\Server\Entity\Scope; -use League\OAuth2\Server\Entity\Client; -use League\OAuth2\Server\Entity\AccessToken; -use League\OAuth2\Server\Entity\Session; +use League\OAuth2\Server\Entity\ScopeEntity; +use League\OAuth2\Server\Entity\ClientEntity; +use League\OAuth2\Server\Entity\AccessTokenEntity; +use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\RefreshToken as RT; use League\OAuth2\Server\AuthorizationServer; use Mockery as M; diff --git a/tests/ResourceServerTest.php b/tests/ResourceServerTest.php index 5d80f78f..794cebb1 100644 --- a/tests/ResourceServerTest.php +++ b/tests/ResourceServerTest.php @@ -4,10 +4,10 @@ namespace LeagueTests; use League\OAuth2\Server\ResourceServer; use League\OAuth2\Server\Grant\GrantTypeInterface; -use League\OAuth2\Server\Entity\AccessToken; -use League\OAuth2\Server\Entity\Session; -use League\OAuth2\Server\Entity\Client; -use League\OAuth2\Server\Entity\Scope; +use League\OAuth2\Server\Entity\AccessTokenEntity; +use League\OAuth2\Server\Entity\SessionEntity; +use League\OAuth2\Server\Entity\ClientEntity; +use League\OAuth2\Server\Entity\ScopeEntity; use \Mockery as M; class ResourceServerTest extends \PHPUnit_Framework_TestCase