ExceptionHandlerPreferences::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 14
cts 14
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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