Completed
Push — master ( 30f3e2...473611 )
by Patrick
03:23
created

Component::handlers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mosaic\Exceptions;
4
5
use Mosaic\Common\Components\AbstractComponent;
6
use Mosaic\Exceptions\Providers\BoobooProvider;
7
use Mosaic\Exceptions\Providers\WhoopsProvider;
8
9
/**
10
 * @method static $this whoops()
11
 * @method static $this booboo()
12
 */
13
final class Component extends AbstractComponent
14
{
15
    /**
16
     * @var array
17
     */
18
    protected $handlers = [];
19
20
    /**
21
     * @var array
22
     */
23
    protected $formatters = [];
24
25
    /**
26
     * @return array
27
     */
28 4
    public function resolveWhoops() : array
29
    {
30
        return [
31 4
            new WhoopsProvider($this->handlers, $this->formatters)
32
        ];
33
    }
34
35
    /**
36
     * @return array
37
     */
38 1
    public function resolveBooboo() : array
39
    {
40
        return [
41 1
            new BoobooProvider($this->handlers, $this->formatters)
42
        ];
43
    }
44
45
    /**
46
     * @param  callable $callback
47
     * @return array
48
     */
49 1
    public function resolveCustom(callable $callback) : array
50
    {
51 1
        return $callback();
52
    }
53
54
    /**
55
     * @param mixed ...$handlers
56
     * @return $this
57
     */
58 2
    public function handlers(...$handlers)
59
    {
60 2
        $this->handlers = $handlers;
61
62 2
        return $this;
63
    }
64
65
    /**
66
     * @param mixed ...$formatters
67
     * @return $this
68
     */
69 2
    public function formatters(...$formatters)
70
    {
71 2
        $this->formatters = $formatters;
72
73 2
        return $this;
74
    }
75
}
76