Completed
Push — master ( 6e52f0...d9a404 )
by Alexandre
02:29
created

AuthorizationCode   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 52
rs 10
c 0
b 0
f 0
ccs 0
cts 20
cp 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getRedirectUri() 0 3 1
A getCode() 0 3 1
A __construct() 0 5 1
A generate() 0 3 1
A getClientIdentifier() 0 2 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 31/12/2017
6
 * Time: 16:31
7
 */
8
9
namespace OAuth2OLD\Credential;
10
11
12
class AuthorizationCode
13
{
14
    /**
15
     * @var string
16
     */
17
    private $code;
18
19
    /**
20
     * @var string
21
     */
22
    private $clientIdentifier;
23
24
    /**
25
     * @var null|string
26
     */
27
    private $redirectUri;
28
29
    public function __construct(string $code, string $clientIdentifier, ?string $redirectUri = null)
30
    {
31
        $this->code = $code;
32
        $this->clientIdentifier = $clientIdentifier;
33
        $this->redirectUri = $redirectUri;
34
    }
35
36
    public function getClientIdentifier() {
37
        return $this->clientIdentifier;
38
    }
39
40
    /**
41
     * @see
42
     *
43
     * @throws \Exception
44
     */
45
    static public function generate()
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
46
    {
47
        return bin2hex(random_bytes(8));
48
    }
49
50
    /**
51
     * @return null|string
52
     */
53
    public function getRedirectUri(): ?string
54
    {
55
        return $this->redirectUri;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getCode(): string
62
    {
63
        return $this->code;
64
    }
65
}