Runner::handleException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mosaic\Exceptions\Adapters\Whoops;
4
5
use Mosaic\Exceptions\Runner as RunnerInterface;
6
use Throwable;
7
use Whoops\Run;
8
9
class Runner implements RunnerInterface
10
{
11
    /**
12
     * @var Run
13
     */
14
    private $delegate;
15
16
    /**
17
     * Runner constructor.
18
     * @param Run $delegate
19
     */
20 5
    public function __construct(Run $delegate)
21
    {
22 5
        $this->delegate = $delegate;
23 5
    }
24
25
    /**
26
     * Registers the error handlers
27
     * @return mixed
28
     */
29 2
    public function register()
30
    {
31 2
        $this->delegate->register();
32 2
    }
33
34
    /**
35
     * @param $handler
36
     * @return RunnerInterface
37
     */
38 1
    public function addHandler($handler)
39
    {
40 1
        $this->delegate->pushHandler($handler);
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * @param $formatter
47
     * @return RunnerInterface
48
     */
49 2
    public function addFormatter($formatter)
50
    {
51 2
        $this->delegate->pushHandler($formatter);
52
53 2
        return $this;
54
    }
55
56
    /**
57
     * @param Throwable $e
58
     */
59 1
    public function handleException(Throwable $e)
60
    {
61 1
        $this->delegate->handleException($e);
62 1
    }
63
}
64