Broke expiration DateTime out into seperate variable for readability

This commit is contained in:
Alex Bilbie 2015-04-06 08:13:41 +01:00
parent 385b03db6f
commit 90d18c553d
3 changed files with 6 additions and 3 deletions

View File

@ -273,7 +273,8 @@ class AuthCodeGrant extends AbstractGrant
// Generate the access token
$accessToken = new AccessTokenEntity($this->server);
$accessToken->setIdentifier(SecureKey::generate());
$accessToken->setExpiryDateTime((new \DateTime)->add($accessTokenTTL));
$expirationDateTime = (new \DateTime())->add($accessTokenTTL);
$accessToken->setExpiryDateTime($expirationDateTime);
$accessToken->setClient($client);
foreach ($code->getScopes() as $scope) {

View File

@ -82,7 +82,8 @@ class ClientCredentialsGrant extends AbstractGrant
// Generate an access token
$accessToken = new AccessTokenEntity();
$accessToken->setIdentifier(SecureKey::generate());
$accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL));
$expirationDateTime = (new \DateTime())->add($accessTokenTTL);
$accessToken->setExpiryDateTime($expirationDateTime);
$accessToken->setClient($client);
$accessToken->setOwner('client', $client->getIdentifier());

View File

@ -147,7 +147,8 @@ class PasswordGrant extends AbstractGrant
// Generate an access token
$accessToken = new AccessTokenEntity();
$accessToken->setIdentifier(SecureKey::generate());
$accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL));
$expirationDateTime = (new \DateTime())->add($accessTokenTTL);
$accessToken->setExpiryDateTime($expirationDateTime);
$accessToken->setOwner('user', $user->getIdentifier());
$accessToken->setClient($client);