Passed
Push — master ( 82d9da...92dcc2 )
by Derek Stephen
03:51
created

RefreshToken::setExpiryDateTime()   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 1
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
     * {@inheritdoc}
41
     */
42 1
    public function setAccessToken(AccessTokenEntityInterface $accessToken)
43
    {
44 1
        $this->accessToken = $accessToken;
45 1
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 1
    public function getAccessToken()
51
    {
52 1
        return $this->accessToken;
53
    }
54
55
    /**
56
     * Get the token's expiry date time.
57
     *
58
     * @return DateTime
59
     */
60 1
    public function getExpiryDateTime()
61
    {
62 1
        return $this->expiryDateTime;
63
    }
64
65
    /**
66
     * Set the date time when the token expires.
67
     *
68
     * @param DateTime $dateTime
69
     */
70 1
    public function setExpiryDateTime(DateTime $dateTime)
71
    {
72 1
        $this->expiryDateTime = $dateTime;
73 1
    }
74
75
    /**
76
     * @return mixed
77
     */
78 1
    public function getIdentifier()
79
    {
80 1
        return $this->identifier;
81
    }
82
83
    /**
84
     * @param mixed $identifier
85
     */
86 1
    public function setIdentifier($identifier)
87
    {
88 1
        $this->identifier = $identifier;
89
    }
90
}