Completed
Push — master ( 7c9eb0...a92430 )
by Thomas
13s
created

ExceptionController::__construct()   A

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;
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