From 78b6bddc4de3f6a537e5fa39789434f15057c715 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 20 Apr 2016 16:29:37 +0900 Subject: [PATCH 1/3] Remove redundant parameters --- src/Repositories/AccessTokenRepositoryInterface.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Repositories/AccessTokenRepositoryInterface.php b/src/Repositories/AccessTokenRepositoryInterface.php index aab8eab8..a3293344 100644 --- a/src/Repositories/AccessTokenRepositoryInterface.php +++ b/src/Repositories/AccessTokenRepositoryInterface.php @@ -10,7 +10,6 @@ namespace League\OAuth2\Server\Repositories; use League\OAuth2\Server\Entities\AccessTokenEntityInterface; -use League\OAuth2\Server\Entities\ClientEntityInterface; /** * Access token interface. @@ -20,13 +19,9 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface /** * Create a new access token * - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $clientEntity - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface[] $scopes - * @param mixed $userIdentifier - * * @return AccessTokenEntityInterface */ - public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null); + public function getNewToken(); /** * Persists a new access token to permanent storage. From a6b7a5cedccdbb6bb3e5dbb69bd036be515e99b2 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 20 Apr 2016 16:52:36 +0900 Subject: [PATCH 2/3] Remove use of redundant parameters --- src/Grant/AbstractGrant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Grant/AbstractGrant.php b/src/Grant/AbstractGrant.php index cef10008..cdbd04ff 100644 --- a/src/Grant/AbstractGrant.php +++ b/src/Grant/AbstractGrant.php @@ -300,7 +300,7 @@ abstract class AbstractGrant implements GrantTypeInterface $userIdentifier, array $scopes = [] ) { - $accessToken = $this->accessTokenRepository->getNewToken($client, $scopes, $userIdentifier); + $accessToken = $this->accessTokenRepository->getNewToken(); $accessToken->setClient($client); $accessToken->setUserIdentifier($userIdentifier); $accessToken->setIdentifier($this->generateUniqueIdentifier()); From 9a93dca05c4240ccc6a9bb99151b702ae5872263 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 20 Apr 2016 16:52:54 +0900 Subject: [PATCH 3/3] Remove redundant parameters in example --- examples/src/Repositories/AccessTokenRepository.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/src/Repositories/AccessTokenRepository.php b/examples/src/Repositories/AccessTokenRepository.php index d7736c76..12386f2c 100644 --- a/examples/src/Repositories/AccessTokenRepository.php +++ b/examples/src/Repositories/AccessTokenRepository.php @@ -43,15 +43,8 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface /** * {@inheritdoc} */ - public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null) + public function getNewToken() { - $accessToken = new AccessTokenEntity(); - $accessToken->setClient($clientEntity); - foreach ($scopes as $scope) { - $accessToken->addScope($scope); - } - $accessToken->setUserIdentifier($userIdentifier); - - return $accessToken; + return new AccessTokenEntity(); } }