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

CallbackTransformerOperation::processData()   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
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Oliverde8\Component\PhpEtl\ChainOperation\Transformer;
4
5
use Oliverde8\Component\PhpEtl\ChainOperation\AbstractChainOperation;
6
use Oliverde8\Component\PhpEtl\ChainOperation\DataChainOperationInterface;
7
use Oliverde8\Component\PhpEtl\Item\DataItemInterface;
8
use Oliverde8\Component\PhpEtl\Item\ItemInterface;
9
10
/**
11
 * Class CallbackTransformerOperation
12
 *
13
 * @author    de Cramer Oliver<[email protected]>
14
 * @copyright 2018 Oliverde8
15
 * @package Oliverde8\Component\PhpEtl\ChainOperation\Transformer
16
 */
17
class CallbackTransformerOperation extends AbstractChainOperation implements DataChainOperationInterface
18
{
19
    protected $callback;
20
21
    /**
22
     * CallbackTransformerOperation constructor.
23
     *
24
     * @param $callback
25
     */
26 4
    public function __construct($callback)
27
    {
28 4
        $this->callback = $callback;
29 4
    }
30
31 4
    public function processData(DataItemInterface $item, array &$context): ItemInterface
32
    {
33 4
        $method = $this->callback;
34 4
        return $method($item, $context);
35
    }
36
}