Exception   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 14 1
1
<?php /** MicroException */
2
3
namespace Micro\Base;
4
5
/**
6
 * Exception specific exception
7
 *
8
 * @author Oleg Lunegov <[email protected]>
9
 * @link https://github.com/linpax/microphp-framework
10
 * @copyright Copyright (c) 2013 Oleg Lunegov
11
 * @license https://github.com/linpax/microphp-framework/blob/master/LICENSE
12
 * @package Micro
13
 * @subpackage Base
14
 * @version 1.0
15
 * @since 1.0
16
 */
17
class Exception extends \Exception
18
{
19
    /**
20
     * @return string
21
     */
22
    public function __toString()
23
    {
24
        header('HTTP/1.1 500 Internal Server Error');
25
26
        printf('<h1>%s</h1><p>In %s: %s</p><pre>%s</pre>',
27
            $this->message,
28
            $this->file,
29
            $this->line,
30
            $this->getTraceAsString()
31
        );
32
33
        error_reporting(0);
34
        exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method __toString() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
35
    }
36
}
37