Completed
Pull Request — master (#1)
by De Cramer
02:11
created

FileWriterFactory::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Oliverde8\Component\PhpEtl\Builder\Factories\Loader;
4
5
use Oliverde8\Component\PhpEtl\Builder\Factories\AbstractFactory;
6
use Oliverde8\Component\PhpEtl\ChainOperation\ChainOperationInterface;
7
use Oliverde8\Component\PhpEtl\Load\File\Csv;
8
use Oliverde8\Component\PhpEtl\Load\File\FileWriterInterface;
9
10
/**
11
 * Class FileWriterFactory
12
 *
13
 * @author    de Cramer Oliver<[email protected]>
14
 * @copyright 2018 Oliverde8
15
 * @package Oliverde8\Component\PhpEtl\Builder\Factories\Loader
16
 */
17
class FileWriterFactory extends AbstractFactory
18
{
19
    /**
20
     * Build an operation of a certain type with the options.
21
     *
22
     * @param String $operation
23
     * @param array $options
24
     *
25
     * @return ChainOperationInterface
26
     */
27
    protected function build($operation, $options)
28
    {
29
        // TODO handle other then csv.
30
        return $this->create(new Csv($options['file']));
0 ignored issues
show
Bug introduced by
new Oliverde8\Component\...e\Csv($options['file']) of type Oliverde8\Component\PhpEtl\Load\File\Csv is incompatible with the type array expected by parameter $arguments of Oliverde8\Component\PhpE...stractFactory::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        return $this->create(/** @scrutinizer ignore-type */ new Csv($options['file']));
Loading history...
31
    }
32
}
33