ExceptionController::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Action\DisplayPrettyExceptions;
15
16
use Symfony\Component\Debug\Exception\FlattenException;
17
use Symfony\Component\Debug\ExceptionHandler;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Debug\ExceptionHandler was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Symfony\Component\HttpFoundation\Response;
19
20
class ExceptionController
21
{
22
    /**
23
     * @var ExceptionHandler
24
     */
25
    private $exceptionHandler;
26
27
    /**
28
     * @param ExceptionHandler $exceptionHandler
29
     */
30 1
    public function __construct(ExceptionHandler $exceptionHandler)
31
    {
32 1
        $this->exceptionHandler = $exceptionHandler;
33 1
    }
34
35
    /**
36
     * @param FlattenException $exception
37
     *
38
     * @return Response
39
     */
40 1
    public function __invoke(FlattenException $exception): Response
41
    {
42 1
        return new Response($this->exceptionHandler->getHtml($exception), $exception->getStatusCode());
43
    }
44
}
45