Passed
Branch development (62ef01)
by Theodoros
06:18
created

FileWriter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setFileName() 0 5 1
A setFolderPath() 0 5 1
A write() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Econda\Business\Exporter\Writer\File;
9
10
use SprykerEco\Zed\Econda\Business\Exporter\Writer\File\Adapter\AdapterInterface;
11
use SprykerEco\Zed\Econda\Business\Exporter\Writer\WriterInterface;
12
13
class FileWriter implements WriterInterface
14
{
15
    /**
16
     * @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\Adapter\AdapterInterface
17
     */
18
    protected $fileWriterAdapter;
19
20
    /**
21
     * @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\Adapter\AdapterInterface $fileWriterAdapter
22
     */
23
    public function __construct(AdapterInterface $fileWriterAdapter)
24
    {
25
        $this->fileWriterAdapter = $fileWriterAdapter;
26
    }
27
28
    /**
29
     * @param string $fileName
30
     *
31
     * @return $this
32
     */
33
    public function setFileName($fileName)
34
    {
35
        $this->fileWriterAdapter->setFileName($fileName);
36
37
        return $this;
38
    }
39
40
    /**
41
     * @param string $directory
42
     *
43
     * @return $this
44
     */
45
    public function setFolderPath($directory)
46
    {
47
        $this->fileWriterAdapter->setFolderPath($directory);
48
49
        return $this;
50
    }
51
52
    /**
53
     * @param array $dataSet
54
     * @param string $type
55
     *
56
     * @return bool
57
     */
58
    public function write(array $dataSet, $type = '')
59
    {
60
        return $this->fileWriterAdapter->write($dataSet, $type);
61
    }
62
}
63