1 | <?php |
||
13 | class Handler{ |
||
|
|||
14 | |||
15 | /** |
||
16 | * Constructor |
||
17 | * |
||
18 | */ |
||
19 | private function __construct(){} |
||
20 | |||
21 | /** |
||
22 | * Register the error and exception handlers. |
||
23 | * Must be called at the beginning of your application |
||
24 | * |
||
25 | * @return void |
||
26 | */ |
||
27 | public static function register(){ |
||
37 | |||
38 | /** |
||
39 | * Handle & log fatal errors |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | public static function fatalErrorHandler(){ |
||
60 | |||
61 | /** |
||
62 | * Handle & log errors |
||
63 | * |
||
64 | * @return void |
||
65 | * @see http://php.net/manual/en/errorfunc.examples.php |
||
66 | */ |
||
67 | public static function errorHandler($errno, $errmsg, $filename, $linenum, $vars){ |
||
85 | |||
86 | /** |
||
87 | * Handle & log exceptions |
||
88 | * |
||
89 | * @return void |
||
90 | * @see http://php.net/manual/en/function.set-exception-handler.php |
||
91 | */ |
||
92 | public static function exceptionHandler($e) { |
||
97 | |||
98 | /** |
||
99 | * Map an error code to error text |
||
100 | * |
||
101 | * @param int $errno |
||
102 | * @return string error text |
||
103 | */ |
||
104 | private static function errorType($errno){ |
||
125 | |||
126 | /** |
||
127 | * display system error page as result or error or exception |
||
128 | * |
||
129 | */ |
||
130 | private static function viewError(){ |
||
133 | |||
134 | } |
||
135 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.