Passed
Push — master ( 2bfb13...b8de7b )
by De Cramer
02:14
created

AbstractChainOperation::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Oliverde8\Component\PhpEtl\ChainOperation;
4
use Oliverde8\Component\PhpEtl\Item\ItemInterface;
5
6
/**
7
 * Class AbstractChainOperation
8
 *
9
 * @author    de Cramer Oliver<[email protected]>
10
 * @copyright 2018 Oliverde8
11
 * @package Oliverde8\Component\PhpEtl\ChainOperation
12
 */
13
class AbstractChainOperation implements ChainOperationInterface
14
{
15
    /**
16
     * @inheritdoc
17
     */
18 7
    public function process(ItemInterface $item, array &$context): ItemInterface
19
    {
20 7
        $method = 'process' . ucfirst($item->getMethod());
21
22 7
        if (method_exists($this, $method)) {
23 7
            return $this->$method($item, $context);
24
        }
25
26 4
        return $item;
27
    }
28
}