clarify names and return types

This commit is contained in:
Julián Gutiérrez 2016-03-15 22:25:28 +01:00
parent 9ffe806112
commit ae0edc40aa

View File

@ -15,6 +15,7 @@ use League\Event\EmitterInterface;
use League\Event\Event; use League\Event\Event;
use League\OAuth2\Server\Entities\AccessTokenEntity; use League\OAuth2\Server\Entities\AccessTokenEntity;
use League\OAuth2\Server\Entities\AuthCodeEntity; use League\OAuth2\Server\Entities\AuthCodeEntity;
use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface; use League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface;
use League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface; use League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface;
use League\OAuth2\Server\Entities\RefreshTokenEntity; use League\OAuth2\Server\Entities\RefreshTokenEntity;
@ -324,22 +325,22 @@ abstract class AbstractGrant implements GrantTypeInterface
/** /**
* Issue an access token. * Issue an access token.
* *
* @param \DateInterval $tokenTTL * @param \DateInterval $accessTokenTTL
* @param \League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface $client * @param \League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface $client
* @param string $userIdentifier * @param string $userIdentifier
* @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[] $scopes * @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[] $scopes
* *
* @return \League\OAuth2\Server\Entities\AccessTokenEntity * @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface
*/ */
protected function issueAccessToken( protected function issueAccessToken(
\DateInterval $tokenTTL, \DateInterval $accessTokenTTL,
ClientEntityInterface $client, ClientEntityInterface $client,
$userIdentifier, $userIdentifier,
array $scopes = [] array $scopes = []
) { ) {
$accessToken = new AccessTokenEntity(); $accessToken = new AccessTokenEntity();
$accessToken->setIdentifier($this->generateUniqueIdentifier()); $accessToken->setIdentifier($this->generateUniqueIdentifier());
$accessToken->setExpiryDateTime((new \DateTime())->add($tokenTTL)); $accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL));
$accessToken->setClient($client); $accessToken->setClient($client);
$accessToken->setUserIdentifier($userIdentifier); $accessToken->setUserIdentifier($userIdentifier);
@ -355,18 +356,16 @@ abstract class AbstractGrant implements GrantTypeInterface
/** /**
* Issue an auth code. * Issue an auth code.
* *
* @param \DateInterval $tokenTTL * @param \DateInterval $authCodeTTL
* @param \League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface $client * @param \League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface $client
* @param string $userIdentifier * @param string $userIdentifier
* @param string $redirectUri * @param string $redirectUri
* @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[] $scopes * @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[] $scopes
* *
* @throws \League\OAuth2\Server\Exception\OAuthServerException * @return \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface
*
* @return \League\OAuth2\Server\Entities\AuthCodeEntity
*/ */
protected function issueAuthCode( protected function issueAuthCode(
\DateInterval $tokenTTL, \DateInterval $authCodeTTL,
ClientEntityInterface $client, ClientEntityInterface $client,
$userIdentifier, $userIdentifier,
$redirectUri, $redirectUri,
@ -374,7 +373,7 @@ abstract class AbstractGrant implements GrantTypeInterface
) { ) {
$authCode = new AuthCodeEntity(); $authCode = new AuthCodeEntity();
$authCode->setIdentifier($this->generateUniqueIdentifier()); $authCode->setIdentifier($this->generateUniqueIdentifier());
$authCode->setExpiryDateTime((new \DateTime())->add($tokenTTL)); $authCode->setExpiryDateTime((new \DateTime())->add($authCodeTTL));
$authCode->setClient($client); $authCode->setClient($client);
$authCode->setUserIdentifier($userIdentifier); $authCode->setUserIdentifier($userIdentifier);
$authCode->setRedirectUri($redirectUri); $authCode->setRedirectUri($redirectUri);
@ -389,11 +388,11 @@ abstract class AbstractGrant implements GrantTypeInterface
} }
/** /**
* @param \League\OAuth2\Server\Entities\AccessTokenEntity $accessToken * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken
* *
* @return \League\OAuth2\Server\Entities\RefreshTokenEntity * @return \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface
*/ */
protected function issueRefreshToken(AccessTokenEntity $accessToken) protected function issueRefreshToken(AccessTokenEntityInterface $accessToken)
{ {
$refreshToken = new RefreshTokenEntity(); $refreshToken = new RefreshTokenEntity();
$refreshToken->setIdentifier($this->generateUniqueIdentifier()); $refreshToken->setIdentifier($this->generateUniqueIdentifier());