src/Entity/ResetPasswordToken.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ResetPasswordTokenRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassResetPasswordTokenRepository::class)]
  6. class ResetPasswordToken
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column(type'integer')]
  11.     private $id;
  12.     #[ORM\Column(type'string'length500)]
  13.     private $value;
  14.     #[ORM\Column(type'integer')]
  15.     private $expirationDate;
  16.     #[ORM\OneToOne(targetEntityUser::class, inversedBy'resetPasswordToken'cascade: ['persist'])]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private $User;
  19.     public function getId(): ?int
  20.     {
  21.         return $this->id;
  22.     }
  23.     public function getValue(): ?string
  24.     {
  25.         return $this->value;
  26.     }
  27.     public function setValue(string $value): self
  28.     {
  29.         $this->value $value;
  30.         return $this;
  31.     }
  32.     public function getExpirationDate(): ?int
  33.     {
  34.         return $this->expirationDate;
  35.     }
  36.     public function setExpirationDate(int $expirationDate): self
  37.     {
  38.         $this->expirationDate $expirationDate;
  39.         return $this;
  40.     }
  41.     public function getUser(): ?User
  42.     {
  43.         return $this->User;
  44.     }
  45.     public function setUser(?User $User): self
  46.     {
  47.         $this->User $User;
  48.         return $this;
  49.     }
  50.     /**
  51.      * Return true if expired, false otherwise
  52.      */
  53.     public function isItExpired(int $currentEpochint $delay): bool
  54.     {
  55.         
  56.         if (($this->getExpirationDate() + $delay) >= $currentEpoch) {
  57.             return false;
  58.         }
  59.         return true;
  60.     }
  61. }