ExceptionRenderer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 36
ccs 7
cts 9
cp 0.7778
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRun() 0 4 1
A render() 0 4 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