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

FileWriterOperation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A processData() 0 5 1
A __construct() 0 3 1
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