ExceptionHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 51
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A report() 0 4 1
A render() 0 4 1
A renderForConsole() 0 4 1
1
<?php
2
3
namespace SfCod\QueueBundle\Handler;
4
5
use Exception;
6
use Psr\Log\LoggerInterface;
7
8
/**
9
 * ExceptionHandler
10
 *
11
 * @author Virchenko Maksim <[email protected]>
12
 */
13
class ExceptionHandler implements ExceptionHandlerInterface
14
{
15
    /**
16
     * @var LoggerInterface
17
     */
18
    protected $logger;
19
20
    /**
21
     * ExceptionHandler constructor.
22
     *
23
     * @param LoggerInterface $logger
24
     */
25
    public function __construct(LoggerInterface $logger)
26
    {
27
        $this->logger = $logger;
28
    }
29
30
    /**
31
     * Report or log an exception.
32
     *
33
     * @param \Exception $e
34
     */
35
    public function report(Exception $e)
36
    {
37
        $this->logger->error($e->getMessage(), ['exception' => $e]);
38
    }
39
40
    /**
41
     * Render an exception into an HTTP response.
42
     *
43
     * @param \HttpRequest $request
44
     * @param \Exception $e
45
     *
46
     * @return \Symfony\Component\HttpFoundation\Response|void
47
     */
48
    public function render($request, Exception $e)
49
    {
50
        return;
51
    }
52
53
    /**
54
     * Render an exception to the console.
55
     *
56
     * @param \Symfony\Component\Console\Output\OutputInterface $output
57
     * @param \Exception $e
58
     */
59
    public function renderForConsole($output, Exception $e)
60
    {
61
        return;
62
    }
63
}
64