ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
BaseReader.php
Go to the documentation of this file.
1<?php
2
4
8
9abstract class BaseReader implements IReader
10{
18 protected $readDataOnly = false;
19
27 protected $readEmptyCells = true;
28
35 protected $includeCharts = false;
36
43 protected $loadSheetsOnly;
44
50 protected $readFilter;
51
52 protected $fileHandle;
53
58
59 public function __construct()
60 {
61 $this->readFilter = new DefaultReadFilter();
62 }
63
64 public function getReadDataOnly()
65 {
67 }
68
69 public function setReadDataOnly($pValue)
70 {
71 $this->readDataOnly = (bool) $pValue;
72
73 return $this;
74 }
75
76 public function getReadEmptyCells()
77 {
79 }
80
81 public function setReadEmptyCells($pValue)
82 {
83 $this->readEmptyCells = (bool) $pValue;
84
85 return $this;
86 }
87
88 public function getIncludeCharts()
89 {
91 }
92
93 public function setIncludeCharts($pValue)
94 {
95 $this->includeCharts = (bool) $pValue;
96
97 return $this;
98 }
99
100 public function getLoadSheetsOnly()
101 {
103 }
104
105 public function setLoadSheetsOnly($value)
106 {
107 if ($value === null) {
108 return $this->setLoadAllSheets();
109 }
110
111 $this->loadSheetsOnly = is_array($value) ? $value : [$value];
112
113 return $this;
114 }
115
116 public function setLoadAllSheets()
117 {
118 $this->loadSheetsOnly = null;
119
120 return $this;
121 }
122
123 public function getReadFilter()
124 {
125 return $this->readFilter;
126 }
127
128 public function setReadFilter(IReadFilter $pValue)
129 {
130 $this->readFilter = $pValue;
131
132 return $this;
133 }
134
135 public function getSecurityScanner()
136 {
138 }
139
145 protected function openFile($pFilename): void
146 {
147 if ($pFilename) {
148 File::assertFile($pFilename);
149
150 // Open file
151 $fileHandle = fopen($pFilename, 'rb');
152 } else {
153 $fileHandle = false;
154 }
155 if ($fileHandle !== false) {
156 $this->fileHandle = $fileHandle;
157 } else {
158 throw new ReaderException('Could not open file ' . $pFilename . ' for reading.');
159 }
160 }
161}
An exception for terminatinating execution or to throw for unit testing.
setReadDataOnly($pValue)
Set read data only Set to true, to advise the Reader only to read data values for cells,...
Definition: BaseReader.php:69
getReadEmptyCells()
Read empty cells? If this is true (the default), then the Reader will read data values for all cells,...
Definition: BaseReader.php:76
setLoadAllSheets()
Set all sheets to load Tells the Reader to load all worksheets from the workbook.
Definition: BaseReader.php:116
setReadEmptyCells($pValue)
Set read empty cells Set to true (the default) to advise the Reader read data values for all cells,...
Definition: BaseReader.php:81
getIncludeCharts()
Read charts in workbook? If this is true, then the Reader will include any charts that exist in the w...
Definition: BaseReader.php:88
setIncludeCharts($pValue)
Set read charts in workbook Set to true, to advise the Reader to include any charts that exist in the...
Definition: BaseReader.php:93
setLoadSheetsOnly($value)
Set which sheets to load.
Definition: BaseReader.php:105
getReadDataOnly()
Read data only? If this is true, then the Reader will only read data values for cells,...
Definition: BaseReader.php:64
setReadFilter(IReadFilter $pValue)
Set read filter.
Definition: BaseReader.php:128
openFile($pFilename)
Open file for reading.
Definition: BaseReader.php:145
getLoadSheetsOnly()
Get which sheets to load Returns either an array of worksheet names (the list of worksheets that shou...
Definition: BaseReader.php:100
static assertFile($filename)
Assert that given path is an existing file and is readable, otherwise throw exception.
Definition: File.php:143