Passed
Push — master ( 3ec415...9f2f47 )
by Daniel
16:25
created

RefreshToken   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 39
ccs 0
cts 17
cp 0
rs 10
c 1
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getCreatedAt() 0 3 1
A setCreatedAt() 0 3 1
A isExpired() 0 3 1
A getExpiredAt() 0 3 1
A getUser() 0 3 1
A setUser() 0 3 1
A setExpiredAt() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\RefreshToken;
15
16
use Symfony\Component\Security\Core\User\UserInterface;
17
18
/**
19
 * @author Vincent Chalamon <[email protected]>
20
 */
21
class RefreshToken
22
{
23
    protected ?\DateTimeInterface $createdAt = null;
24
    protected ?\DateTimeInterface $expiredAt = null;
25
    protected ?UserInterface $user = null;
26
27
    public function getCreatedAt(): ?\DateTimeInterface
28
    {
29
        return $this->createdAt;
30
    }
31
32
    public function setCreatedAt(\DateTimeInterface $createdAt): void
33
    {
34
        $this->createdAt = $createdAt;
35
    }
36
37
    public function getExpiredAt(): ?\DateTimeInterface
38
    {
39
        return $this->expiredAt;
40
    }
41
42
    public function setExpiredAt(\DateTimeInterface $expiredAt): void
43
    {
44
        $this->expiredAt = $expiredAt;
45
    }
46
47
    public function getUser(): ?UserInterface
48
    {
49
        return $this->user;
50
    }
51
52
    public function setUser(UserInterface $user): void
53
    {
54
        $this->user = $user;
55
    }
56
57
    public function isExpired(): bool
58
    {
59
        return new \DateTimeImmutable() < $this->expiredAt;
60
    }
61
}
62