From ba30e34511f9585ee9e7f66637d188e5e6545ed8 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 10 Apr 2016 14:31:05 +0100 Subject: [PATCH] Lazy set $accessTokenTTL --- src/Server.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Server.php b/src/Server.php index 48448b5e..65de57eb 100644 --- a/src/Server.php +++ b/src/Server.php @@ -111,8 +111,12 @@ class Server implements EmitterAwareInterface * @param \League\OAuth2\Server\Grant\GrantTypeInterface $grantType * @param \DateInterval $accessTokenTTL */ - public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL) + public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL = null) { + if ($accessTokenTTL instanceof DateInterval === false) { + $accessTokenTTL = new \DateInterval('PT1H'); + } + $grantType->setAccessTokenRepository($this->accessTokenRepository); $grantType->setClientRepository($this->clientRepository); $grantType->setScopeRepository($this->scopeRepository); @@ -121,7 +125,6 @@ class Server implements EmitterAwareInterface $grantType->setEmitter($this->getEmitter()); $this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType; - $this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL; }