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

ExceptionController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
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