From 90d18c553d2747f2c8a2bf275c76848817485837 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 6 Apr 2015 08:13:41 +0100 Subject: [PATCH] Broke expiration DateTime out into seperate variable for readability --- src/Grant/AuthCodeGrant.php | 3 ++- src/Grant/ClientCredentialsGrant.php | 3 ++- src/Grant/PasswordGrant.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index d6411237..acd2f381 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -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) { diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index 39cab779..50be9a1f 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -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()); diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index c29c867c..e50f4708 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -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);