Completed
Push — master ( 610136...82575c )
by De Cramer
06:15 queued 03:00
created

FileWriterOperation::processData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
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
    public function __construct(FileWriterInterface $writer)
29
    {
30
        $this->writer = $writer;
31
    }
32
33
34
    public function processData(DataItemInterface $item, array &$context): ItemInterface
35
    {
36
        $this->writer->write($item->getData());
37
38
        return $item;
39
    }
40
}
41