AbstractProcessingHandler::process()   A
last analyzed

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
 * This file is part of the error-handling package.
4
 *
5
 * Copyright (c) Dusan Vejin
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
declare(strict_types=1);
12
13
namespace WeCodeIn\ErrorHandling\Handler;
14
15
use Throwable;
16
use WeCodeIn\ErrorHandling\Processor\ProcessorInterface;
17
18
abstract class AbstractProcessingHandler extends AbstractHandler
19
{
20
    private $processors;
21
22 30
    public function __construct(ProcessorInterface ...$processors)
23
    {
24 30
        $this->processors = $processors;
25 30
    }
26
27 4
    final protected function process(Throwable $throwable) : Throwable
28
    {
29 4
        foreach ($this->processors as $processor) {
30 4
            $throwable = $processor($throwable);
31
        }
32
33 4
        return $throwable;
34
    }
35
}
36