ExceptionHandlerPreferences   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 35
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 1
A displayDebug() 0 4 1
1
<?php
2
3
namespace Equip\Handler;
4
5
use Equip\Env;
6
use Equip\Structure\Dictionary;
7
use Whoops\Handler\JsonResponseHandler;
8
use Whoops\Handler\PlainTextHandler;
9
use Whoops\Handler\PrettyPageHandler;
10
use Whoops\Handler\XmlResponseHandler;
11
12
class ExceptionHandlerPreferences extends Dictionary
13
{
14
15
    /**
16
     * @var UserRepository
17
     */
18
    private $debug;
19
20
    /**
21
     * @inheritDoc
22
     */
23 14
    public function __construct(array $data = [], Env $env)
24
    {
25
        $data += [
26 14
            'text/html' => PrettyPageHandler::class,
27 14
            'application/javascript' => JsonResponseHandler::class,
28 14
            'application/json' => JsonResponseHandler::class,
29 14
            'application/ld+json' => JsonResponseHandler::class,
30 14
            'application/vnd.api+json' => JsonResponseHandler::class,
31 14
            'application/vnd.geo+json' => JsonResponseHandler::class,
32 14
            'application/xml' => XmlResponseHandler::class,
33 14
            'application/atom+xml' => XmlResponseHandler::class,
34 14
            'application/rss+xml' => XmlResponseHandler::class,
35 14
            'text/plain' => PlainTextHandler::class,
36
        ]; // @codeCoverageIgnore
37
38 14
        $this->debug = (bool) $env->getValue('DEBUG_STACKTRACE', false);
0 ignored issues
show
Documentation Bug introduced by
It seems like (bool) $env->getValue('DEBUG_STACKTRACE', false) of type boolean is incompatible with the declared type object<Equip\Handler\UserRepository> of property $debug.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
39 14
        parent::__construct($data);
40 14
    }
41
42 13
    public function displayDebug( )
43
    {
44 13
        return $this->debug;
45
    }
46
}
47