Passed
Push — master ( 19fc27...8d3ce8 )
by Alexandre
02:16
created

AuthorizationCode::getRedirectUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 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: 07/03/2018
6
 * Time: 21:57
7
 */
8
9
namespace OAuth2\Credentials;
10
11
class AuthorizationCode implements AuthorizationCodeInterface
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $code;
17
    /**
18
     * @var string[]
19
     */
20
    protected $scopes;
21
    /**
22
     * @var string
23
     */
24
    protected $clientIdentifier;
25
    /**
26
     * @var string
27
     */
28
    protected $resourceOwnerIdentifier;
29
    /**
30
     * @var string[]|null
31
     */
32
    protected $requestedScopes;
33
    /**
34
     * @var string|null
35
     */
36
    protected $redirectUri;
37
    /**
38
     * @var \DateTimeInterface
39
     */
40
    protected $expiresAt;
41
42
    public function __construct(string $code, string $scopes, string $clientIdentifier, string $resourceOwnerIdentifier,
43
                                int $expiresAt, ?array $requestedScopes = null, ?string $redirectUri = null)
44
    {
45
        $this->code = $code;
46
        $this->scopes = $scopes;
0 ignored issues
show
Documentation Bug introduced by
It seems like $scopes of type string is incompatible with the declared type string[] of property $scopes.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
47
        $this->clientIdentifier = $clientIdentifier;
48
        $this->resourceOwnerIdentifier = $resourceOwnerIdentifier;
49
        $this->expiresAt = $expiresAt;
0 ignored issues
show
Documentation Bug introduced by
It seems like $expiresAt of type integer is incompatible with the declared type DateTimeInterface of property $expiresAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
50
        $this->requestedScopes = $requestedScopes;
51
        $this->redirectUri = $redirectUri;
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getCode(): string
58
    {
59
        return $this->code;
60
    }
61
62
    /**
63
     * @return array
64
     */
65
    public function getScopes(): array
66
    {
67
        return $this->scopes;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function getClientIdentifier(): string
74
    {
75
        return $this->clientIdentifier;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getResourceOwnerIdentifier(): string
82
    {
83
        return $this->resourceOwnerIdentifier;
84
    }
85
86
    public function getExpiresAt(): \DateTimeInterface
87
    {
88
        return $this->expiresAt;
89
    }
90
91
    /**
92
     * @return null|string[]
93
     */
94
    public function getRequestedScopes(): ?array
95
    {
96
        return $this->requestedScopes;
97
    }
98
99
    /**
100
     * @return null|string
101
     */
102
    public function getRedirectUri(): ?string
103
    {
104
        return $this->redirectUri;
105
    }
106
}