CsvFormat::getDelimiter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Mathielen\ImportEngine\Storage\Format;
4
5
class CsvFormat extends Format
6
{
7
    private $delimiter = ';';
8
    private $enclosure = '"';
9
    private $escape = '\\';
10
    private $headerinfirstrow = true;
11
12
    protected $id = 'csv';
13
    protected $name = 'CSV File';
14
15 22
    public function __construct($delimiter = ';', $enclosure = '"', $escape = '\\', $headerinfirstrow = true)
16
    {
17 22
        $this->delimiter = $delimiter;
18 22
        $this->enclosure = $enclosure;
19 22
        $this->escape = $escape;
20 22
        $this->headerinfirstrow = $headerinfirstrow;
21 22
    }
22
23 6
    public function isHeaderInFirstRow()
24
    {
25 6
        return $this->headerinfirstrow;
26
    }
27
28 6
    public function getDelimiter()
29
    {
30 6
        return $this->delimiter;
31
    }
32
33 6
    public function getEnclosure()
34
    {
35 6
        return $this->enclosure;
36
    }
37
38 6
    public function getEscape()
39
    {
40 6
        return $this->escape;
41
    }
42
43
    public function __toString()
44
    {
45
        return parent::__toString().' (Separator = '.$this->delimiter.')';
46
    }
47
}
48