mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 17:56:14 +05:30
Import DateTime instead of using root namespace
This commit is contained in:
parent
a15995c126
commit
385b03db6f
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace League\OAuth2\Server\Entities\Traits;
|
namespace League\OAuth2\Server\Entities\Traits;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
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;
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ trait TokenEntityTrait
|
|||||||
protected $scopes = [];
|
protected $scopes = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
* @var DateTime
|
||||||
*/
|
*/
|
||||||
protected $expiryDateTime;
|
protected $expiryDateTime;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ trait TokenEntityTrait
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the token's expiry date time
|
* Get the token's expiry date time
|
||||||
* @return \DateTime
|
* @return DateTime
|
||||||
*/
|
*/
|
||||||
public function getExpiryDateTime()
|
public function getExpiryDateTime()
|
||||||
{
|
{
|
||||||
@ -70,9 +71,9 @@ trait TokenEntityTrait
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the date time when the token expires
|
* Set the date time when the token expires
|
||||||
* @param \DateTime $dateTime
|
* @param DateTime $dateTime
|
||||||
*/
|
*/
|
||||||
public function setExpiryDateTime(\DateTime $dateTime)
|
public function setExpiryDateTime(DateTime $dateTime)
|
||||||
{
|
{
|
||||||
$this->expiryDateTime = $dateTime;
|
$this->expiryDateTime = $dateTime;
|
||||||
}
|
}
|
||||||
@ -130,6 +131,6 @@ trait TokenEntityTrait
|
|||||||
*/
|
*/
|
||||||
public function isExpired()
|
public function isExpired()
|
||||||
{
|
{
|
||||||
return (new \DateTime()) > $this->getExpiryDateTime();
|
return (new DateTime()) > $this->getExpiryDateTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user