vendor/league/oauth2-server-bundle/src/Model/RefreshToken.php line 7

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace League\Bundle\OAuth2ServerBundle\Model;
  4. class RefreshToken implements RefreshTokenInterface
  5. {
  6.     /**
  7.      * @var string
  8.      */
  9.     private $identifier;
  10.     /**
  11.      * @var \DateTimeInterface
  12.      */
  13.     private $expiry;
  14.     /**
  15.      * @var AccessToken|null
  16.      */
  17.     private $accessToken;
  18.     /**
  19.      * @var bool
  20.      */
  21.     private $revoked false;
  22.     /**
  23.      * @psalm-mutation-free
  24.      */
  25.     public function __construct(string $identifier\DateTimeInterface $expiry, ?AccessToken $accessToken null)
  26.     {
  27.         $this->identifier $identifier;
  28.         $this->expiry $expiry;
  29.         $this->accessToken $accessToken;
  30.     }
  31.     /**
  32.      * @psalm-mutation-free
  33.      */
  34.     public function __toString(): string
  35.     {
  36.         return $this->getIdentifier();
  37.     }
  38.     /**
  39.      * @psalm-mutation-free
  40.      */
  41.     public function getIdentifier(): string
  42.     {
  43.         return $this->identifier;
  44.     }
  45.     /**
  46.      * @psalm-mutation-free
  47.      */
  48.     public function getExpiry(): \DateTimeInterface
  49.     {
  50.         return $this->expiry;
  51.     }
  52.     /**
  53.      * @psalm-mutation-free
  54.      */
  55.     public function getAccessToken(): ?AccessTokenInterface
  56.     {
  57.         return $this->accessToken;
  58.     }
  59.     /**
  60.      * @psalm-mutation-free
  61.      */
  62.     public function isRevoked(): bool
  63.     {
  64.         return $this->revoked;
  65.     }
  66.     public function revoke(): RefreshTokenInterface
  67.     {
  68.         $this->revoked true;
  69.         return $this;
  70.     }
  71. }