WriterForPhp5Dot3::writeOne()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * @author: stev leibelt <[email protected]>
4
 * @since: 2015-05-13
5
 */
6
7
namespace Net\Bazzline\Component\Csv\Writer;
8
9
/**
10
 * Class WriterForPhp5Dot3
11
 * @package Net\Bazzline\Component\Csv\Writer
12
 */
13
class WriterForPhp5Dot3 extends Writer
14
{
15
    public function __destruct()
16
    {
17
        $this->close();
18
    }
19
20
    /**
21
     * @param mixed|array $data
22
     * @return false|int
23
     */
24
    public function writeOne($data)
25
    {
26
        $data = $this->convertToArrayIfNeeded($data);
27
28
        return fputcsv($this->getFileHandler(), $data, $this->getDelimiter(), $this->getEnclosure());
29
    }
30
31
    /**
32
     * @param string $path
33
     * @return resource
34
     */
35
    protected function open($path)
36
    {
37
        $fileHandler = fopen($path, $this->getFileHandlerOpenMode());
38
39
        return $fileHandler;
40
    }
41
}