ApiException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 34
rs 10
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
use Exception;
14
15
/**
16
 * Class ApiException.
17
 *
18
 * @author Jafar Jabr <[email protected]>
19
 */
20
final class ApiException extends Exception
21
{
22
    const INVALID_TOKEN = 'invalid_token';
23
24
    const UNVERIFIED_TOKEN = 'unverified_token';
25
26
    const EXPIRED_TOKEN = 'expired_token';
27
28
    const INVALID_CONFIG = 'invalid_config';
29
30
    const UNSIGNED_TOKEN = 'unsigned_token';
31
32
    /**
33
     * @var string
34
     */
35
    private $reason;
36
37
    /**
38
     * @param string         $reason
39
     * @param string         $message
40
     * @param Exception|null $previous
41
     */
42
    public function __construct($reason, $message, Exception $previous = null)
43
    {
44
        $this->reason = $reason;
45
        parent::__construct($message, 500, $previous);
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getReason()
52
    {
53
        return $this->reason;
54
    }
55
}
56