Token::getAuthorizationCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 10/03/2018
6
 * Time: 15:57
7
 */
8
9
namespace OAuth2\Credentials;
10
11
12
abstract class Token implements TokenInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $token;
18
    /**
19
     * @var string[]
20
     */
21
    protected $scopes;
22
    /**
23
     * @var string
24
     */
25
    protected $clientIdentifier;
26
    /**
27
     * @var string|null
28
     */
29
    protected $resourceOwnerIdentifier;
30
    /**
31
     * @var \DateTimeInterface
32
     */
33
    protected $expiresAt;
34
    /**
35
     * @var string|null
36
     */
37
    protected $authorizationCode;
38
    /**
39
     * @var string|null
40
     */
41
    protected $refreshToken;
42
43
    public function __construct(string $token, array $scopes, string $clientIdentifier, ?string $resourceOwnerIdentifier,
44
                                \DateTimeInterface $expiresAt, ?string $authorizationCode = null, ?string $refreshToken = null)
45
    {
46
        $this->token = $token;
47
        $this->scopes = $scopes;
48
        $this->clientIdentifier = $clientIdentifier;
49
        $this->resourceOwnerIdentifier = $resourceOwnerIdentifier;
50
        $this->expiresAt = $expiresAt;
51
        $this->authorizationCode = $authorizationCode;
52
        $this->refreshToken = $refreshToken;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getToken(): string
59
    {
60
        return $this->token;
61
    }
62
63
    /**
64
     * @return string[]
65
     */
66
    public function getScopes(): array
67
    {
68
        return $this->scopes;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getClientIdentifier(): string
75
    {
76
        return $this->clientIdentifier;
77
    }
78
79
    /**
80
     * @return string|null
81
     */
82
    public function getResourceOwnerIdentifier(): ?string
83
    {
84
        return $this->resourceOwnerIdentifier;
85
    }
86
87
    /**
88
     * @return \DateTimeInterface
89
     */
90
    public function getExpiresAt(): \DateTimeInterface
91
    {
92
        return $this->expiresAt;
93
    }
94
95
    /**
96
     * @return string
97
     */
98
    public function getAuthorizationCode(): ?string
99
    {
100
        return $this->authorizationCode;
101
    }
102
103
}