OAuth2AuthorizationException::getAuthorization()   A
last analyzed

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
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2019 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Component\AuthorizationEndpoint\Exception;
15
16
use OAuth2Framework\Component\AuthorizationEndpoint\AuthorizationRequest\AuthorizationRequest;
17
18
class OAuth2AuthorizationException extends \Exception
19
{
20
    /**
21
     * @var AuthorizationRequest
22
     */
23
    private $authorization;
24
25
    /**
26
     * @var null|string
27
     */
28
    private $errorDescription;
29
30
    public function __construct(string $error, ?string $errorDescription, AuthorizationRequest $authorization, ?\Throwable $previous = null)
31
    {
32
        $this->authorization = $authorization;
33
        $this->errorDescription = $errorDescription;
34
35
        parent::__construct($error, 0, $previous);
36
    }
37
38
    public function getAuthorization(): AuthorizationRequest
39
    {
40
        return $this->authorization;
41
    }
42
43
    public function getErrorDescription(): ?string
44
    {
45
        return $this->errorDescription;
46
    }
47
}
48