|
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 the row iterators should use the original rows' indices as keys. */ |
|
18
|
|
|
protected $shouldPreserveRowIndices = false; |
|
19
|
|
|
|
|
20
|
|
|
/** @var bool Whether to skip "empty" rows. The exact definition of empty may depend on the reader implementation. */ |
|
21
|
|
|
// protected $shouldOmitEmptyRows = true; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Sets whether date/time values should be returned as PHP objects or be formatted as strings. |
|
25
|
|
|
* |
|
26
|
|
|
* @param bool $shouldFormatDates |
|
27
|
|
|
* @return ReaderOptions |
|
28
|
|
|
*/ |
|
29
|
6 |
|
public function setShouldFormatDates($shouldFormatDates) |
|
30
|
|
|
{ |
|
31
|
6 |
|
$this->shouldFormatDates = (bool)$shouldFormatDates; |
|
32
|
6 |
|
return $this; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Sets whether the row iterators should use the original rows' indices as keys. |
|
37
|
|
|
* |
|
38
|
|
|
* @param bool $shouldPreserveRowIndices |
|
39
|
|
|
* @return ReaderOptions |
|
40
|
|
|
*/ |
|
41
|
6 |
|
public function setShouldPreserveRowIndices($shouldPreserveRowIndices) |
|
42
|
|
|
{ |
|
43
|
6 |
|
$this->shouldPreserveRowIndices = (bool)$shouldPreserveRowIndices; |
|
44
|
6 |
|
return $this; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Sets whether to skip or return "empty" rows. |
|
49
|
|
|
* |
|
50
|
|
|
* @param bool $shouldOmitEmptyRows |
|
51
|
|
|
* @return ReaderOptions |
|
52
|
|
|
* |
|
53
|
|
|
public function setShouldOmitEmptyRows($shouldOmitEmptyRows) |
|
54
|
|
|
{ |
|
55
|
|
|
$this->shouldOmitEmptyRows = (bool)$shouldOmitEmptyRows; |
|
56
|
|
|
return $this; |
|
57
|
|
|
}*/ |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @see setShouldFormatDates |
|
61
|
|
|
* @return bool |
|
62
|
|
|
*/ |
|
63
|
153 |
|
public function shouldFormatDates() |
|
64
|
|
|
{ |
|
65
|
153 |
|
return $this->shouldFormatDates; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @see setShouldFormatDates |
|
70
|
|
|
* @return bool |
|
71
|
|
|
*/ |
|
72
|
90 |
|
public function shouldPreserveRowIndices() |
|
73
|
|
|
{ |
|
74
|
90 |
|
return $this->shouldPreserveRowIndices; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @see setShouldFormatDates |
|
79
|
|
|
* @return bool |
|
80
|
|
|
* |
|
81
|
|
|
public function shouldOmitEmptyRows() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->shouldOmitEmptyRows; |
|
84
|
|
|
}*/ |
|
85
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|