Completed
Push — master ( 0a7856...92f941 )
by Derek Stephen
02:59 queued 28s
created

RefreshToken::getExpiryDateTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace OAuth;
4
5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
8
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
9
use League\OAuth2\Server\Entities\Traits\RefreshTokenTrait;
10
11
/**
12
 * @ORM\Entity(repositoryClass="OAuth\Repository\RefreshTokenRepository")
13
 * @ORM\Table(name="RefreshToken")
14
 */
15
class RefreshToken implements RefreshTokenEntityInterface
16
{
17
    use RefreshTokenTrait;
18
19
    /**
20
     * @var string
21
     * @ORM\Id
22
     * @ORM\Column(type="string", length=40)
23
     */
24
    protected $identifier;
25
26
    /**
27
     * @var AccessTokenEntityInterface
28
     * @ORM\OneToOne(targetEntity="OAuth\AccessToken")
29
     * @ORM\JoinColumn(name="accessToken", referencedColumnName="identifier")
30
     */
31
    protected $accessToken;
32
33
    /**
34
     * @var DateTime
35
     * @ORM\Column(type="date",nullable=true)
36
     */
37
    protected $expiryDateTime;
38
39
    /**
40
     * @var bool
41
     * @ORM\Column(type="boolean")
42
     */
43
    protected $revoked = false;
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 1
    public function setAccessToken(AccessTokenEntityInterface $accessToken)
49
    {
50 1
        $this->accessToken = $accessToken;
51 1
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 1
    public function getAccessToken()
57
    {
58 1
        return $this->accessToken;
59
    }
60
61
    /**
62
     * Get the token's expiry date time.
63
     *
64
     * @return DateTime
65
     */
66 1
    public function getExpiryDateTime()
67
    {
68 1
        return $this->expiryDateTime;
69
    }
70
71
    /**
72
     * Set the date time when the token expires.
73
     *
74
     * @param DateTime $dateTime
75
     */
76 1
    public function setExpiryDateTime(DateTime $dateTime)
77
    {
78 1
        $this->expiryDateTime = $dateTime;
79 1
    }
80
81
    /**
82
     * @return mixed
83
     */
84 1
    public function getIdentifier()
85
    {
86 1
        return $this->identifier;
87
    }
88
89
    /**
90
     * @param mixed $identifier
91
     */
92 1
    public function setIdentifier($identifier)
93
    {
94 1
        $this->identifier = $identifier;
95 1
    }
96
97
    /**
98
     * @return bool
99
     */
100
    public function isRevoked(): bool
101
    {
102
        return $this->revoked;
103
    }
104
105
    /**
106
     * @param bool $revoked
107
     */
108
    public function setRevoked(bool $revoked): void
109
    {
110
        $this->revoked = $revoked;
111
    }
112
}