Completed
Push — master ( f1ba49...53f0a9 )
by Dusan
9s
created

HandlerAggregate   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 26
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A register() 0 6 2
A restore() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WeCodeIn\ErrorHandling\Handler;
6
7
final class HandlerAggregate implements HandlerInterface
8
{
9
    /**
10
     * @var HandlerInterface[]
11
     */
12
    private $handlers;
13
14 2
    public function __construct(HandlerInterface ...$handlers)
15
    {
16 2
        $this->handlers = $handlers;
17 2
    }
18
19 1
    public function register()
20
    {
21 1
        foreach ($this->handlers as $handler) {
22 1
            $handler->register();
23
        }
24 1
    }
25
26 1
    public function restore()
27
    {
28 1
        foreach ($this->handlers as $handler) {
29 1
            $handler->restore();
30
        }
31 1
    }
32
}
33