ErrorEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getThrowable() 0 3 1
A __toString() 0 3 1
A __construct() 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\EventDispatcher\Event;
15
16
/**
17
 * Class ErrorEvent
18
 *
19
 * @package CoiSA\ErrorHandler\EventDispatcher\Event
20
 */
21
final class ErrorEvent implements ErrorEventInterface
22
{
23
    /**
24
     * @var \Throwable
25
     */
26
    private $throwable;
27
28
    /**
29
     * ErrorEvent constructor.
30
     *
31
     * @param \Throwable $throwable
32
     *
33
     * @TODO Add debug stack back trace
34
     */
35 1
    public function __construct(\Throwable $throwable)
36
    {
37 1
        $this->throwable = $throwable;
38 1
    }
39
40
    /**
41
     * @return string
42
     */
43 1
    public function __toString(): string
44
    {
45 1
        return (string) $this->getThrowable();
46
    }
47
48
    /**
49
     * @return \Throwable
50
     */
51 1
    public function getThrowable(): \Throwable
52
    {
53 1
        return $this->throwable;
54
    }
55
}
56