Passed
Branch development (0519a2)
by Theodoros
02:02
created

FileWriter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 49
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
    /**
17
     * @var \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\Adapter\AdapterInterface
18
     */
19
    protected $fileWriterAdapter;
20
21
    /**
22
     * @param \SprykerEco\Zed\Econda\Business\Exporter\Writer\File\Adapter\AdapterInterface $fileWriterAdapter
23
     */
24
    public function __construct(AdapterInterface $fileWriterAdapter)
25
    {
26
        $this->fileWriterAdapter = $fileWriterAdapter;
27
    }
28
29
    /**
30
     * @param string $fileName
31
     *
32
     * @return $this
33
     */
34
    public function setFileName($fileName)
35
    {
36
        $this->fileWriterAdapter->setFileName($fileName);
37
38
        return $this;
39
    }
40
41
    /**
42
     * @param string $directory
43
     *
44
     * @return $this
45
     */
46
    public function setFolderPath($directory)
47
    {
48
        $this->fileWriterAdapter->setFolderPath($directory);
49
50
        return $this;
51
    }
52
53
    /**
54
     * @param array $dataSet
55
     * @param string $type
56
     *
57
     * @return bool
58
     */
59
    public function write(array $dataSet, $type = '')
60
    {
61
        return (bool)$this->fileWriterAdapter->write($dataSet, $type);
62
    }
63
64
}
65