Completed
Pull Request — master (#1029)
by Andrew
04:48
created

RefreshTokenTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 48
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setAccessToken() 0 4 1
A getAccessToken() 0 4 1
A setExpiryDateTime() 0 4 1
A getExpiryDateTime() 0 4 1
1
<?php
2
/**
3
 * @author      Alex Bilbie <[email protected]>
4
 * @copyright   Copyright (c) Alex Bilbie
5
 * @license     http://mit-license.org/
6
 *
7
 * @link        https://github.com/thephpleague/oauth2-server
8
 */
9
10
namespace League\OAuth2\Server\Entities\Traits;
11
12
use DateTimeImmutable;
13
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
14
15
trait RefreshTokenTrait
16
{
17
    /**
18
     * @var AccessTokenEntityInterface
19
     */
20
    protected $accessToken;
21
22
    /**
23
     * @var DateTimeImmutable
24
     */
25
    protected $expiryDateTime;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 12
    public function setAccessToken(AccessTokenEntityInterface $accessToken)
31
    {
32 12
        $this->accessToken = $accessToken;
33 12
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 1
    public function getAccessToken()
39
    {
40 1
        return $this->accessToken;
41
    }
42
43
    /**
44
     * Get the token's expiry date time.
45
     *
46
     * @return DateTimeImmutable
47
     */
48
    public function getExpiryDateTime()
49
    {
50
        return $this->expiryDateTime;
51
    }
52
53
    /**
54
     * Set the date time when the token expires.
55
     *
56
     * @param DateTimeImmutable $dateTime
57
     */
58 12
    public function setExpiryDateTime(DateTimeImmutable $dateTime)
59
    {
60 12
        $this->expiryDateTime = $dateTime;
61 12
    }
62
}
63