Completed
Pull Request — master (#235)
by
unknown
03:20
created

ReaderOptions   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 52
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setShouldFormatDates() 0 5 1
A setShouldPreserveEmptyRows() 0 5 1
A shouldFormatDates() 0 4 1
A shouldPreserveEmptyRows() 0 4 1
1
<?php
2
3
namespace Box\Spout\Reader;
4
5
/**
6
 * Class ReaderOptions
7
 * This helper class is used to hold common reader options.
8
 *
9
 * @package Box\Spout\Reader
10
 */
11
class ReaderOptions
12
{
13
14
    /** @var bool Whether date/time values should be returned as PHP objects or be formatted as strings */
15
    protected $shouldFormatDates = false;
16
17
    /** @var bool Whether to skip "empty" rows. The exact definition of empty may depend on the reader implementation. */
18
    protected $shouldPreserveEmptyRows = false;
19
20
    /**
21
     * Sets whether date/time values should be returned as PHP objects or be formatted as strings.
22
     *
23
     * @param bool $shouldFormatDates
24
     * @return ReaderOptions
25
     */
26 6
    public function setShouldFormatDates($shouldFormatDates)
27
    {
28 6
        $this->shouldFormatDates = (bool)$shouldFormatDates;
29 6
        return $this;
30
    }
31
32
    /**
33
     * Sets whether to skip or return "empty" rows.
34
     *
35
     * @param bool $shouldPreserveEmptyRows
36
     * @return ReaderOptions
37
     */
38 15
    public function setShouldPreserveEmptyRows($shouldPreserveEmptyRows)
39
    {
40 15
        $this->shouldPreserveEmptyRows = (bool)$shouldPreserveEmptyRows;
41 15
        return $this;
42
    }
43
44
    /**
45
     * @see setShouldFormatDates
46
     * @return bool
47
     */
48 171
    public function shouldFormatDates()
49
    {
50 171
        return $this->shouldFormatDates;
51
    }
52
53
    /**
54
     * @see setShouldPreserveEmptyRows
55
     * @return bool
56
     */
57 105
    public function shouldPreserveEmptyRows()
58
    {
59 105
        return $this->shouldPreserveEmptyRows;
60
    }
61
62
}
63