From 3cd5f50e64d626edadf337ea277341a8a06c7c9c Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 16 Jan 2014 16:49:46 +0000 Subject: [PATCH] Renamed Entities/ folder to Entity/ --- .../{Entities => Entity}/AbstractToken.php | 8 ++--- .../{Entities => Entity}/AccessToken.php | 2 +- .../Server/{Entities => Entity}/Client.php | 4 +-- .../{Entities => Entity}/RefreshToken.php | 6 ++-- .../Server/{Entities => Entity}/Scope.php | 2 +- .../Server/{Entities => Entity}/Session.php | 31 +++++++++++-------- 6 files changed, 29 insertions(+), 24 deletions(-) rename src/League/OAuth2/Server/{Entities => Entity}/AbstractToken.php (94%) rename src/League/OAuth2/Server/{Entities => Entity}/AccessToken.php (96%) rename src/League/OAuth2/Server/{Entities => Entity}/Client.php (95%) rename src/League/OAuth2/Server/{Entities => Entity}/RefreshToken.php (92%) rename src/League/OAuth2/Server/{Entities => Entity}/Scope.php (97%) rename src/League/OAuth2/Server/{Entities => Entity}/Session.php (86%) diff --git a/src/League/OAuth2/Server/Entities/AbstractToken.php b/src/League/OAuth2/Server/Entity/AbstractToken.php similarity index 94% rename from src/League/OAuth2/Server/Entities/AbstractToken.php rename to src/League/OAuth2/Server/Entity/AbstractToken.php index eb775c7b..12d91367 100644 --- a/src/League/OAuth2/Server/Entities/AbstractToken.php +++ b/src/League/OAuth2/Server/Entity/AbstractToken.php @@ -9,7 +9,7 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Entities; +namespace League\OAuth2\Server\Entity; use League\OAuth2\Server\Storage\SessionStorageInterface; use League\OAuth2\Server\Util\SecureKey; @@ -130,7 +130,7 @@ abstract class AbstractToken /** * Associate a scope - * @param \League\OAuth2\Server\Entities\Scope $scope + * @param \League\OAuth2\Server\Entity\Scope $scope * @return self */ public function associateScope(Scope $scope) @@ -158,7 +158,7 @@ abstract class AbstractToken /** * Return all scopes associated with the session - * @return array Array of \League\OAuth2\Server\Entities\Scope + * @return array Array of \League\OAuth2\Server\Entity\Scope */ public function getScopes() { @@ -173,7 +173,7 @@ abstract class AbstractToken /** * Format the local scopes array - * @param array $unformated Array of Array of \League\OAuth2\Server\Entities\Scope + * @param array $unformated Array of \League\OAuth2\Server\Entity\Scope * @return array */ private function formatScopes($unformated = []) diff --git a/src/League/OAuth2/Server/Entities/AccessToken.php b/src/League/OAuth2/Server/Entity/AccessToken.php similarity index 96% rename from src/League/OAuth2/Server/Entities/AccessToken.php rename to src/League/OAuth2/Server/Entity/AccessToken.php index 57805674..b6206b95 100644 --- a/src/League/OAuth2/Server/Entities/AccessToken.php +++ b/src/League/OAuth2/Server/Entity/AccessToken.php @@ -9,7 +9,7 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Entities; +namespace League\OAuth2\Server\Entity; use League\OAuth2\Server\Storage\SessionStorageInterface; use League\OAuth2\Server\Storage\AccessTokenInterface; diff --git a/src/League/OAuth2/Server/Entities/Client.php b/src/League/OAuth2/Server/Entity/Client.php similarity index 95% rename from src/League/OAuth2/Server/Entities/Client.php rename to src/League/OAuth2/Server/Entity/Client.php index c4232dab..35f1ebdf 100644 --- a/src/League/OAuth2/Server/Entities/Client.php +++ b/src/League/OAuth2/Server/Entity/Client.php @@ -9,7 +9,7 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Entities; +namespace League\OAuth2\Server\Entity; use League\OAuth2\Server\Exception\ServerException; use League\OAuth2\Server\AbstractServer; @@ -45,7 +45,7 @@ class Client /** * Authorization or resource server - * @var \League\OAuth2\Server\Authorization|\League\OAuth2\Server\Resource + * @var \League\OAuth2\Server\AbstractServer */ protected $server; diff --git a/src/League/OAuth2/Server/Entities/RefreshToken.php b/src/League/OAuth2/Server/Entity/RefreshToken.php similarity index 92% rename from src/League/OAuth2/Server/Entities/RefreshToken.php rename to src/League/OAuth2/Server/Entity/RefreshToken.php index 7d91f0ad..2bcb7d8b 100644 --- a/src/League/OAuth2/Server/Entities/RefreshToken.php +++ b/src/League/OAuth2/Server/Entity/RefreshToken.php @@ -9,7 +9,7 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Entities; +namespace League\OAuth2\Server\Entity; use League\OAuth2\Server\Storage\SessionStorageInterface; use League\OAuth2\Server\Storage\RefreshTokenInterface; @@ -24,13 +24,13 @@ class RefreshToken extends AbstractToken { /** * Access token associated to refresh token - * @var \League\OAuth2\Server\Entities\AccessToken + * @var \League\OAuth2\Server\Entity\AccessToken */ protected $accessToken; /** * Associate an access token - * @param \League\OAuth2\Server\Entities\AccessToken $accessToken + * @param \League\OAuth2\Server\Entity\AccessToken $accessToken * @return self */ public function setAccessToken(AccessToken $accessToken) diff --git a/src/League/OAuth2/Server/Entities/Scope.php b/src/League/OAuth2/Server/Entity/Scope.php similarity index 97% rename from src/League/OAuth2/Server/Entities/Scope.php rename to src/League/OAuth2/Server/Entity/Scope.php index 8abc3801..3ffc97d5 100644 --- a/src/League/OAuth2/Server/Entities/Scope.php +++ b/src/League/OAuth2/Server/Entity/Scope.php @@ -9,7 +9,7 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Entities; +namespace League\OAuth2\Server\Entity; use League\OAuth2\Server\Exception\ServerException; use League\OAuth2\Server\AbstractServer; diff --git a/src/League/OAuth2/Server/Entities/Session.php b/src/League/OAuth2/Server/Entity/Session.php similarity index 86% rename from src/League/OAuth2/Server/Entities/Session.php rename to src/League/OAuth2/Server/Entity/Session.php index 69dec964..c79a88b0 100644 --- a/src/League/OAuth2/Server/Entities/Session.php +++ b/src/League/OAuth2/Server/Entity/Session.php @@ -9,7 +9,7 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Entities; +namespace League\OAuth2\Server\Entity; use League\OAuth2\Server\Exception\OAuth2Exception; use League\OAuth2\Server\Storage\SessionInterface; @@ -32,7 +32,7 @@ class Session * Client identifier * @var string */ - protected $clientId; + protected $client; /** * Session owner identifier @@ -48,19 +48,19 @@ class Session /** * Auth code - * @var \League\OAuth2\Server\Entities\AuthCode + * @var \League\OAuth2\Server\Entity\AuthCode */ protected $authCode; /** * Access token - * @var \League\OAuth2\Server\Entities\AccessToken + * @var \League\OAuth2\Server\Entity\AccessToken */ protected $accessToken; /** * Refresh token - * @var \League\OAuth2\Server\Entities\RefreshToken + * @var \League\OAuth2\Server\Entity\RefreshToken */ protected $refreshToken; @@ -109,7 +109,7 @@ class Session /** * Associate a scope - * @param \League\OAuth2\Server\Entities\Scope $scope + * @param \League\OAuth2\Server\Entity\Scope $scope * @return self */ public function associateScope(Scope $scope) @@ -137,7 +137,7 @@ class Session /** * Return all scopes associated with the session - * @return array Array of \League\OAuth2\Server\Entities\Scope + * @return array Array of \League\OAuth2\Server\Entity\Scope */ public function getScopes() { @@ -150,7 +150,7 @@ class Session /** * Format the local scopes array - * @param array $unformated Array of Array of \League\OAuth2\Server\Entities\Scope + * @param array $unformated Array of Array of \League\OAuth2\Server\Entity\Scope * @return array */ private function formatScopes($unformated = []) @@ -166,7 +166,7 @@ class Session /** * Associate an access token with the session - * @param \League\OAuth2\Server\Entities\AccessToken $accessToken + * @param \League\OAuth2\Server\Entity\AccessToken $accessToken * @return self */ public function associateAccessToken(AccessToken $accessToken) @@ -177,7 +177,7 @@ class Session /** * Associate a refresh token with the session - * @param \League\OAuth2\Server\Entities\RefreshToken $refreshToken + * @param \League\OAuth2\Server\Entity\RefreshToken $refreshToken * @return self */ public function associateRefreshToken(RefreshToken $refreshToken) @@ -188,7 +188,7 @@ class Session /** * Associate an authorization code with the session - * @param \League\OAuth2\Server\Entities\AuthCode $authCode + * @param \League\OAuth2\Server\Entity\AuthCode $authCode * @return self */ public function associateAuthCode(AuthCode $authCode) @@ -199,7 +199,7 @@ class Session /** * Associate a client with the session - * @param League\OAuth2\Server\Entities\Client $client The client + * @param League\OAuth2\Server\Entity\Client $client The client * @return self */ public function associateClient(Client $client) @@ -210,10 +210,15 @@ class Session /** * Return the session client - * @return League\OAuth2\Server\Entities\Client + * @return League\OAuth2\Server\Entity\Client */ public function getClient() { + if ($this->client instanceof Client) { + return $this->client; + } + + $this->client = $this->server->getStorage('client')->getBySession($this->getId()); return $this->client; }