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

FileWriterOperation::processData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Oliverde8\Component\PhpEtl\ChainOperation\Loader;
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
use Oliverde8\Component\PhpEtl\Model\File\FileWriterInterface;
10
11
/**
12
 * Class FileWriter
13
 *
14
 * @author    de Cramer Oliver<[email protected]>
15
 * @copyright 2018 Oliverde8
16
 * @package Oliverde8\Component\PhpEtl\ChainOperation\Loader
17
 */
18
class FileWriterOperation extends AbstractChainOperation implements DataChainOperationInterface
19
{
20
    /** @var FileWriterInterface */
21
    protected $writer;
22
23
    /**
24
     * FileWriter constructor.
25
     *
26
     * @param FileWriterInterface $writer
27
     */
28 1
    public function __construct(FileWriterInterface $writer)
29
    {
30 1
        $this->writer = $writer;
31 1
    }
32
33
34 1
    public function processData(DataItemInterface $item, array &$context): ItemInterface
35
    {
36 1
        $this->writer->write($item->getData());
37
38 1
        return $item;
39
    }
40
}
41