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

Component   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 63
ccs 12
cts 12
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A resolveWhoops() 0 6 1
A resolveBooboo() 0 6 1
A resolveCustom() 0 4 1
A handlers() 0 6 1
A formatters() 0 6 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