ExceptionHandlerProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 50
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDefinitions() 0 10 1
getRunner() 0 1 ?
1
<?php
2
3
namespace Mosaic\Exceptions\Providers;
4
5
use Interop\Container\Definition\DefinitionProviderInterface;
6
use Mosaic\Exceptions\Runner;
7
8
abstract class ExceptionHandlerProvider implements DefinitionProviderInterface
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $formatters;
14
15
    /**
16
     * @var array
17
     */
18
    protected $handlers;
19
20
    /**
21
     * @param array $handlers
22
     * @param array $formatters
23
     */
24 10
    public function __construct(array $handlers = [], array $formatters = [])
25
    {
26 10
        $this->formatters = $formatters;
27 10
        $this->handlers   = $handlers;
28 10
    }
29
30
    /**
31
     * Returns the definition to register in the container.
32
     *
33
     * Definitions must be indexed by their entry ID. For example:
34
     *
35
     *     return [
36
     *         'logger' => ...
37
     *         'mailer' => ...
38
     *     ];
39
     *
40
     * @return array
41
     */
42 2
    public function getDefinitions()
43
    {
44 2
        $runner = $this->getRunner();
45
46 2
        $runner->register();
47
48
        return [
49 2
            Runner::class => $runner
50
        ];
51
    }
52
53
    /**
54
     * @return Runner
55
     */
56
    abstract public function getRunner() : Runner;
57
}
58