RouterException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 6
c 1
b 0
f 1
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
1
<?php
2
/**
3
 *
4
 * KNUT7 K7F (https://marciozebedeu.com/)
5
 * KNUT7 K7F (tm) : Rapid Development Framework (https://marciozebedeu.com/)
6
 *
7
 * Licensed under The MIT License
8
 * For full copyright and license information, please see the LICENSE.txt
9
 * Redistributions of files must retain the above copyright notice.
10
 *
11
 * @link      https://github.com/knut7/framework/ for the canonical source repository
12
 * @copyright (c) 2015.  KNUT7  Software Technologies AO Inc. (https://marciozebedeu.com/)
13
 * @license   https://marciozebedeu.com/license/new-bsd New BSD License
14
 * @author    Marcio Zebedeu - [email protected]
15
 * @version   1.0.14
16
 *
17
 *
18
 */
19
20
namespace Ballybran\Routing\Router;
21
22
use Exception;
23
24
class RouterException
25
{
26
    /**
27
     * @var bool $debug Debug mode
28
     */
29
    public static $debug = false;
30
31
    /**
32
     * Create Exception Class.
33
     *
34
     * @param string $message
35
     *
36
     * @param int    $statusCode
37
     *
38
     * @throws Exception
39
     */
40
    public function __construct(string $message, int $statusCode = 500)
41
    {
42
        http_response_code($statusCode);
43
        if (self::$debug) {
44
            throw new Exception($message, $statusCode);
45
        }
46
        die("<h2>Opps! An error occurred.</h2> {$message}");
47
    }
48
}
49