Total Complexity | 3 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class Token implements TokenInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $token; |
||
21 | |||
22 | /** |
||
23 | * @var DateTime |
||
24 | */ |
||
25 | protected $createdAt; |
||
26 | |||
27 | /** |
||
28 | * @var DateTime |
||
29 | */ |
||
30 | protected $expiresAt; |
||
31 | |||
32 | /** |
||
33 | * @param $token |
||
34 | * @param DateTime $createdAt |
||
35 | * @param DateInterval $ttl |
||
36 | */ |
||
37 | public function __construct($token, DateTime $createdAt, DateInterval $ttl) |
||
38 | { |
||
39 | $this->token = $token; |
||
40 | $this->createdAt = clone $createdAt; |
||
41 | $this->expiresAt = clone $this->createdAt; |
||
42 | $this->expiresAt->add($ttl); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public function getToken() |
||
49 | { |
||
50 | return $this->token; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | public function isNonExpired() |
||
59 | } |
||
60 | } |
||
61 |