Total Complexity | 4 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
17 | class Token implements TokenInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $token; |
||
23 | |||
24 | /** |
||
25 | * @var DateTime |
||
26 | */ |
||
27 | protected $createdAt; |
||
28 | |||
29 | /** |
||
30 | * @var DateTime |
||
31 | */ |
||
32 | protected $expiresAt; |
||
33 | |||
34 | public function __construct(string $token, DateTime $createdAt, DateInterval $ttl) |
||
35 | { |
||
36 | $this->token = $token; |
||
37 | $this->createdAt = clone $createdAt; |
||
38 | $this->expiresAt = clone $this->createdAt; |
||
39 | $this->expiresAt->add($ttl); |
||
40 | } |
||
41 | |||
42 | public function getToken(): string |
||
45 | } |
||
46 | |||
47 | public function getExpiresAt(): DateTime |
||
50 | } |
||
51 | |||
52 | public function isNonExpired(): bool |
||
57 |