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

HandlerAggregate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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