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

ApiException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
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