Completed
Push — master ( 53f0a9...9832d4 )
by Dusan
11s
created

AbstractProcessingHandler::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WeCodeIn\ErrorHandling\Handler;
6
7
use Throwable;
8
use WeCodeIn\ErrorHandling\Processor\ProcessorInterface;
9
10
abstract class AbstractProcessingHandler extends AbstractHandler
11
{
12
    /**
13
     * @var ProcessorInterface[]
14
     */
15
    private $processors;
16
17 11
    public function __construct(ProcessorInterface ...$processors)
18
    {
19 11
        $this->processors = $processors;
20 11
    }
21
22 3
    protected function process(Throwable $throwable) : Throwable
23
    {
24 3
        foreach ($this->processors as $processor) {
25 3
            $throwable = $processor($throwable);
26
        }
27
28 3
        return $throwable;
29
    }
30
}
31