WriterForPhp5Dot3   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 29
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __destruct() 0 4 1
A writeOne() 0 6 1
A open() 0 6 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
}