CsvFormat   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 43
ccs 14
cts 16
cp 0.875
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A isHeaderInFirstRow() 0 4 1
A getDelimiter() 0 4 1
A getEnclosure() 0 4 1
A getEscape() 0 4 1
A __toString() 0 4 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