Passed
Push — master ( 0bd3f5...0b454c )
by Mike
05:30
created

HandlerProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handleException() 0 4 2
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\ExceptionHandler\Business\Handler;
5
6
7
class HandlerProvider implements HandlerProviderInterface
8
{
9
    /**
10
     * @var HandlerCollection
11
     */
12
    private $collection;
13
14
    /**
15
     * @var bool
16
     */
17
    private $isDebug;
18
19
    /**
20
     * HandlerProvider constructor.
21
     *
22
     * @param \Xervice\ExceptionHandler\Business\Handler\HandlerCollection $collection
23
     * @param bool $isDebug
24
     */
25 3
    public function __construct(HandlerCollection $collection, bool $isDebug)
26
    {
27 3
        $this->collection = $collection;
28 3
        $this->isDebug = $isDebug;
29 3
    }
30
31
    /**
32
     * @param \Exception $exception
33
     */
34 3
    public function handleException(\Exception $exception): void
35
    {
36 3
        foreach ($this->collection as $handler) {
37 2
            $handler->handleException($exception, $this->isDebug);
38
        }
39 3
    }
40
}
41