Passed
Push — master ( 90db0f...396226 )
by Jafar
03:16
created

ApiException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReason() 0 3 1
A __construct() 0 4 1
1
<?php
2
/*
3
 * This file is part of the Guarded Authentication package.
4
 *
5
 * (c) Jafar Jabr <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Jafar\Bundle\GuardedAuthenticationBundle\Exception;
12
13
/**
14
 * Class ApiException.
15
 *
16
 * @author Jafar Jabr <[email protected]>
17
 */
18
final class ApiException extends \Exception
19
{
20
    const INVALID_TOKEN = 'invalid_token';
21
22
    const UNVERIFIED_TOKEN = 'unverified_token';
23
24
    const EXPIRED_TOKEN = 'expired_token';
25
26
    const INVALID_CONFIG = 'invalid_config';
27
28
    const UNSIGNED_TOKEN = 'unsigned_token';
29
30
    /**
31
     * @var string
32
     */
33
    private $reason;
34
35
    /**
36
     * @param string          $reason
37
     * @param string          $message
38
     * @param \Exception|null $previous
39
     */
40
    public function __construct($reason, $message, \Exception $previous = null)
41
    {
42
        $this->reason = $reason;
43
        parent::__construct($message, 500, $previous);
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getReason()
50
    {
51
        return $this->reason;
52
    }
53
}
54