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

AbstractChainOperation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 2
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
}