From 027971776b70bc0d5e0c440aa037568b84e40fde Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 4 Apr 2015 15:41:53 +0100 Subject: [PATCH] Namespace renamed TokenType > TokenTypes --- .../AbstractTokenType.php | 48 +++++-------------- src/{TokenType => TokenTypes}/Bearer.php | 4 +- src/{TokenType => TokenTypes}/MAC.php | 2 +- .../TokenTypeInterface.php | 18 ++----- 4 files changed, 20 insertions(+), 52 deletions(-) rename src/{TokenType => TokenTypes}/AbstractTokenType.php (51%) rename src/{TokenType => TokenTypes}/Bearer.php (90%) rename src/{TokenType => TokenTypes}/MAC.php (98%) rename src/{TokenType => TokenTypes}/TokenTypeInterface.php (75%) diff --git a/src/TokenType/AbstractTokenType.php b/src/TokenTypes/AbstractTokenType.php similarity index 51% rename from src/TokenType/AbstractTokenType.php rename to src/TokenTypes/AbstractTokenType.php index adb8837b..41e5ca4f 100644 --- a/src/TokenType/AbstractTokenType.php +++ b/src/TokenTypes/AbstractTokenType.php @@ -9,12 +9,11 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\TokenType; +namespace League\OAuth2\Server\TokenTypes; -use League\OAuth2\Server\AbstractServer; -use League\OAuth2\Server\Entity\SessionEntity; +use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface; -abstract class AbstractTokenType +abstract class AbstractTokenType implements TokenTypeInterface { /** * Response array @@ -24,38 +23,9 @@ abstract class AbstractTokenType protected $response = []; /** - * Server - * - * @var \League\OAuth2\Server\AbstractServer $server + * @var \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface */ - protected $server; - - /** - * Server - * - * @var \League\OAuth2\Server\Entity\SessionEntity $session - */ - protected $session; - - /** - * {@inheritdoc} - */ - public function setServer(AbstractServer $server) - { - $this->server = $server; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function setSession(SessionEntity $session) - { - $this->session = $session; - - return $this; - } + protected $accessToken; /** * {@inheritdoc} @@ -72,4 +42,12 @@ abstract class AbstractTokenType { return isset($this->response[$key]) ? $this->response[$key] : null; } + + /** + * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken + */ + public function setAccessToken(AccessTokenEntityInterface $accessToken) + { + $this->accessToken = $accessToken; + } } diff --git a/src/TokenType/Bearer.php b/src/TokenTypes/Bearer.php similarity index 90% rename from src/TokenType/Bearer.php rename to src/TokenTypes/Bearer.php index 797de3ac..47e1a908 100644 --- a/src/TokenType/Bearer.php +++ b/src/TokenTypes/Bearer.php @@ -9,11 +9,11 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\TokenType; +namespace League\OAuth2\Server\TokenTypes; use Symfony\Component\HttpFoundation\Request; -class Bearer extends AbstractTokenType implements TokenTypeInterface +class Bearer extends AbstractTokenType { /** * {@inheritdoc} diff --git a/src/TokenType/MAC.php b/src/TokenTypes/MAC.php similarity index 98% rename from src/TokenType/MAC.php rename to src/TokenTypes/MAC.php index 1eb3b930..48c2274f 100644 --- a/src/TokenType/MAC.php +++ b/src/TokenTypes/MAC.php @@ -9,7 +9,7 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\TokenType; +namespace League\OAuth2\Server\TokenTypes; use League\OAuth2\Server\Util\SecureKey; use Symfony\Component\HttpFoundation\ParameterBag; diff --git a/src/TokenType/TokenTypeInterface.php b/src/TokenTypes/TokenTypeInterface.php similarity index 75% rename from src/TokenType/TokenTypeInterface.php rename to src/TokenTypes/TokenTypeInterface.php index 17c2c1cf..4c4c36d9 100644 --- a/src/TokenType/TokenTypeInterface.php +++ b/src/TokenTypes/TokenTypeInterface.php @@ -9,9 +9,10 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\TokenType; +namespace League\OAuth2\Server\TokenTypes; use League\OAuth2\Server\AbstractServer; +use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface; use League\OAuth2\Server\Entity\SessionEntity; use Symfony\Component\HttpFoundation\Request; @@ -25,13 +26,9 @@ interface TokenTypeInterface public function generateResponse(); /** - * Set the server - * - * @param \League\OAuth2\Server\AbstractServer $server - * - * @return self + * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken */ - public function setServer(AbstractServer $server); + public function setAccessToken(AccessTokenEntityInterface $accessToken); /** * Set a key/value response pair @@ -50,13 +47,6 @@ interface TokenTypeInterface */ public function getParam($key); - /** - * @param \League\OAuth2\Server\Entity\SessionEntity $session - * - * @return self - */ - public function setSession(SessionEntity $session); - /** * Determine the access token in the authorization header *