Completed
Push — master ( fec6f1...fc6f01 )
by Alexandre
03:31
created

AuthorizationRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A getCodeChallengeMethod() 0 3 1
A getCodeChallenge() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 11/06/2018
6
 * Time: 21:05
7
 */
8
9
namespace OAuth2\Extensions\PKCE\Endpoints\Authorization;
10
11
12
class AuthorizationRequest extends \OAuth2\Endpoints\Authorization\AuthorizationRequest
13
{
14
    /**
15
     * @var string
16
     */
17
    private $codeChallenge;
18
    /**
19
     * @var string
20
     */
21
    private $codeChallengeMethod;
22
23
    public function __construct(\OAuth2\Endpoints\Authorization\AuthorizationRequest $authorizationRequest,
24
                                string $codeChallenge, string $codeChallengeMethod = 'plain')
25
    {
26
        parent::__construct($authorizationRequest->getData(),
27
            $authorizationRequest->getResourceOwner(),
28
            $authorizationRequest->getClient(),
29
            $authorizationRequest->getRedirectUri(),
30
            $authorizationRequest->getResponseType(),
31
            $authorizationRequest->getResponseMode(),
32
            $authorizationRequest->getScopes(),
33
            $authorizationRequest->getRequestedScopes(),
34
            $authorizationRequest->getState());
35
36
        $this->codeChallenge = $codeChallenge;
37
        $this->codeChallengeMethod = $codeChallengeMethod;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getCodeChallenge(): string
44
    {
45
        return $this->codeChallenge;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getCodeChallengeMethod(): string
52
    {
53
        return $this->codeChallengeMethod;
54
    }
55
}