ExceptionRenderer::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Foo\Debug\Exceptions\Handlers\Whoops;
6
7
use Exception;
8
use Opulence\Framework\Debug\Exceptions\Handlers\Http;
9
use Throwable;
10
use Whoops\RunInterface;
11
12
class ExceptionRenderer extends Http\ExceptionRenderer implements Http\IExceptionRenderer
13
{
14
    /** @var RunInterface */
15
    protected $run;
16
17
    /**
18
     * WhoopsRenderer constructor.
19
     *
20
     * @param RunInterface $run
21
     * @param bool         $inDevelopmentEnvironment
22
     */
23 1
    public function __construct(RunInterface $run, bool $inDevelopmentEnvironment = false)
24
    {
25 1
        $this->run = $run;
26
27 1
        parent::__construct($inDevelopmentEnvironment);
28 1
    }
29
30
    /**
31
     * @return RunInterface
32
     */
33
    public function getRun()
34
    {
35
        return $this->run;
36
    }
37
38
    /**
39
     * Renders an exception
40
     *
41
     * @param Throwable|Exception $ex The thrown exception
42
     */
43 1
    public function render($ex)
44
    {
45 1
        $this->run->handleException($ex);
0 ignored issues
show
Bug introduced by
It seems like $ex defined by parameter $ex on line 43 can also be of type object<Exception>; however, Whoops\RunInterface::handleException() does only seem to accept object<Throwable>, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
46 1
    }
47
}
48