DispatchThrowableHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handleThrowable() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of coisa/error-handler.
5
 *
6
 * (c) Felipe Sayão Lobato Abreu <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
declare(strict_types=1);
13
14
namespace CoiSA\ErrorHandler\Handler;
15
16
use Psr\EventDispatcher\EventDispatcherInterface;
17
18
/**
19
 * Class DispatchThrowableHandler
20
 *
21
 * @package CoiSA\ErrorHandler\Handler
22
 */
23
final class DispatchThrowableHandler implements ThrowableHandlerInterface
24
{
25
    /**
26
     * @var EventDispatcherInterface
27
     */
28
    private $eventDispatcher;
29
30
    /**
31
     * DispatchThrowableHandler constructor.
32
     *
33
     * @param EventDispatcherInterface $eventDispatcher
34
     */
35 34
    public function __construct(EventDispatcherInterface $eventDispatcher)
36
    {
37 34
        $this->eventDispatcher = $eventDispatcher;
38 34
    }
39
40
    /**
41
     * @param \Throwable $throwable
42
     */
43 1
    public function handleThrowable(\Throwable $throwable): void
44
    {
45 1
        $this->eventDispatcher->dispatch($throwable);
46 1
    }
47
}
48