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

HandlerAggregate::restore()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
crap 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