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

RefreshToken::getExpiredAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
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