Failed Conditions
Push — ng ( ede6c5...efffe8 )
by Florent
11:50
created

OAuth2AuthorizationException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getAuthorization() 0 4 1
A getErrorDescription() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 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\Server\AuthorizationEndpoint\Exception;
15
16
use OAuth2Framework\Component\Server\AuthorizationEndpoint\Authorization;
17
18
final class OAuth2AuthorizationException extends \Exception
19
{
20
    /**
21
     * @var Authorization
22
     */
23
    private $authorization;
24
25
    /**
26
     * @var null|string
27
     */
28
    private $errorDescription;
29
30
    /**
31
     * OAuth2AuthorizationException constructor.
32
     *
33
     * @param int             $code
34
     * @param string          $error
35
     * @param null|string     $errorDescription
36
     * @param Authorization   $authorization
37
     * @param \Exception|null $previous
38
     */
39
    public function __construct(int $code, string $error, ?string $errorDescription, Authorization $authorization, ? \Exception $previous = null)
40
    {
41
        $this->authorization = $authorization;
42
        $this->errorDescription = $errorDescription;
43
44
        parent::__construct($error, $code, $previous);
45
    }
46
47
    /**
48
     * @return Authorization
49
     */
50
    public function getAuthorization(): Authorization
51
    {
52
        return $this->authorization;
53
    }
54
55
    /**
56
     * @return null|string
57
     */
58
    public function getErrorDescription(): ?string
59
    {
60
        return $this->errorDescription;
61
    }
62
}
63