RefreshTokenTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

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