Completed
Pull Request — develop_3.0 (#457)
by Adrien
02:34
created

OptionsManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 28
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedOptions() 0 10 1
A setDefaultOptions() 0 8 1
1
<?php
2
3
namespace Box\Spout\Reader\CSV\Manager;
4
5
use Box\Spout\Common\Helper\EncodingHelper;
6
use Box\Spout\Common\Manager\OptionsManagerAbstract;
7
use Box\Spout\Reader\Common\Entity\Options;
8
9
/**
10
 * Class OptionsManager
11
 * CSV Reader options manager
12
 *
13
 * @package Box\Spout\Reader\CSV\Manager
14
 */
15
class OptionsManager extends OptionsManagerAbstract
16
{
17
    /**
18
     * @inheritdoc
19
     */
20 31
    protected function getSupportedOptions()
21
    {
22
        return [
23 31
            Options::SHOULD_FORMAT_DATES,
24 31
            Options::SHOULD_PRESERVE_EMPTY_ROWS,
25 31
            Options::FIELD_DELIMITER,
26 31
            Options::FIELD_ENCLOSURE,
27 31
            Options::ENCODING,
28
        ];
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34 31
    protected function setDefaultOptions()
35
    {
36 31
        $this->setOption(Options::SHOULD_FORMAT_DATES, false);
37 31
        $this->setOption(Options::SHOULD_PRESERVE_EMPTY_ROWS, false);
38 31
        $this->setOption(Options::FIELD_DELIMITER, ',');
39 31
        $this->setOption(Options::FIELD_ENCLOSURE, '"');
40 31
        $this->setOption(Options::ENCODING, EncodingHelper::ENCODING_UTF8);
41 31
    }
42
}
43