Completed
Push — master ( d14457...da0e1e )
by Derek Stephen
25:25 queued 19:55
created

RefreshToken   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
eloc 11
dl 0
loc 74
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

6 Methods

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