Completed
Pull Request — master (#338)
by Adrien
02:31
created

ReaderOptionsCommon::setShouldFormatDates()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Box\Spout\Reader;
4
5
/**
6
 * Class ReaderOptionsCommon
7
 * Readers' common options
8
 *
9
 * @package Box\Spout\Reader
10
 */
11
class ReaderOptionsCommon
12
{
13
    /** @var bool Whether date/time values should be returned as PHP objects or be formatted as strings */
14
    protected $shouldFormatDates = false;
15
16
    /** @var bool Whether empty rows should be returned or skipped */
17
    protected $shouldPreserveEmptyRows = false;
18
19
    /**
20
     * @return bool Whether date/time values should be returned as PHP objects or be formatted as strings.
21
     */
22 174
    public function shouldFormatDates()
23
    {
24 174
        return $this->shouldFormatDates;
25
    }
26
27
    /**
28
     * Sets whether date/time values should be returned as PHP objects or be formatted as strings.
29
     *
30
     * @param bool $shouldFormatDates
31
     * @return ReaderOptionsCommon
32
     */
33 186
    public function setShouldFormatDates($shouldFormatDates)
34
    {
35 186
        $this->shouldFormatDates = $shouldFormatDates;
36 186
        return $this;
37
    }
38
39
    /**
40
     * @return bool Whether empty rows should be returned or skipped.
41
     */
42 252
    public function shouldPreserveEmptyRows()
43
    {
44 252
        return $this->shouldPreserveEmptyRows;
45
    }
46
47
    /**
48
     * Sets whether empty rows should be returned or skipped.
49
     *
50
     * @param bool $shouldPreserveEmptyRows
51
     * @return ReaderOptionsCommon
52
     */
53 246
    public function setShouldPreserveEmptyRows($shouldPreserveEmptyRows)
54
    {
55 246
        $this->shouldPreserveEmptyRows = $shouldPreserveEmptyRows;
56 246
        return $this;
57
    }
58
}
59