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

ReaderOptions::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
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
ccs 3
cts 3
cp 1
cc 1
eloc 3
nc 1
nop 1
crap 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 24
    public function setShouldPreserveEmptyRows($shouldPreserveEmptyRows)
39
    {
40 24
        $this->shouldPreserveEmptyRows = (bool)$shouldPreserveEmptyRows;
41 24
        return $this;
42
    }
43
44
    /**
45
     * @see setShouldFormatDates
46
     * @return bool
47
     */
48 180
    public function shouldFormatDates()
49
    {
50 180
        return $this->shouldFormatDates;
51
    }
52
53
    /**
54
     * @see setShouldPreserveEmptyRows
55
     * @return bool
56
     */
57 114
    public function shouldPreserveEmptyRows()
58
    {
59 114
        return $this->shouldPreserveEmptyRows;
60
    }
61
62
}
63