This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /******************************************************************** |
||
3 | * Created by: Marko Kungla @ OkramLabs on Aug 6, 2012 - 9:32:04 |
||
4 | * Contact: [email protected] - https://okramlabs.com |
||
5 | * @copyright: 2015 OkramLabs - https://okramlabs.com |
||
6 | * @license MIT |
||
7 | * |
||
8 | * Package name:libhowi-filesystem |
||
9 | * @category HOWI3 |
||
10 | * @package libhowi |
||
11 | * @subpackage filesystem |
||
12 | * |
||
13 | * Lang: PHP |
||
14 | * Encoding: UTF-8 |
||
15 | * File: FileInterface.inc |
||
16 | * @link https:// |
||
17 | ******************************************************************** |
||
18 | * Contributors: |
||
19 | * @author Marko Kungla <[email protected]> |
||
20 | * Github: https://github.com/mkungla |
||
21 | ******************************************************************** |
||
22 | * Comments: |
||
23 | */ |
||
24 | namespace HOWI3\libhowi\Filesystem\Commons\ObjectInterfaces; |
||
25 | |||
26 | interface FileInterface |
||
27 | { |
||
28 | |||
29 | /** |
||
30 | * current |
||
31 | * |
||
32 | * Retrieve current line of file |
||
33 | * |
||
34 | * @return string|array Retrieves the current line of the file. |
||
35 | * If the FileObject::READ_CSV flag is set, this method returns |
||
36 | * an array containing the current line parsed as CSV data. |
||
37 | */ |
||
38 | public function current(); |
||
39 | |||
40 | /** |
||
41 | * Reached end of file |
||
42 | * |
||
43 | * Determine whether the end of file has been reached |
||
44 | * |
||
45 | * @return bool Returns TRUE if file is at EOF, FALSE otherwise. |
||
46 | */ |
||
47 | public function eof(); |
||
48 | |||
49 | /** |
||
50 | * Assert that if some wierd reason this is called in file |
||
51 | * that we return false |
||
52 | */ |
||
53 | public function getLinkTarget(); |
||
0 ignored issues
–
show
|
|||
54 | |||
55 | /** |
||
56 | * Portable file locking |
||
57 | * |
||
58 | * Locks or unlocks the file in the same portable way as flock(). |
||
59 | * |
||
60 | * @param unknown $operation |
||
61 | * operation is one of the following: |
||
62 | * LOCK_SH to acquire a shared lock (reader). |
||
63 | * LOCK_EX to acquire an exclusive lock (writer). |
||
64 | * LOCK_UN to release a lock (shared or exclusive). |
||
65 | * LOCK_NB to not block while locking (not supported on Windows). |
||
66 | * |
||
67 | * @param unknown $wouldblock |
||
0 ignored issues
–
show
Should the type for parameter
$wouldblock not be unknown|null ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
68 | * Set to TRUE if the lock would block (EWOULDBLOCK errno condition). |
||
69 | * |
||
70 | * @return bool Returns TRUE on success or FALSE on failure. |
||
71 | */ |
||
72 | public function flock($operation, &$wouldblock = null); |
||
73 | |||
74 | /** |
||
75 | * FileObject does not have children |
||
76 | * |
||
77 | * @return bool Returns FALSE |
||
78 | */ |
||
79 | public function hasChildren(); |
||
80 | |||
81 | /** |
||
82 | * No purpose |
||
83 | * inherited from iterator but useless |
||
84 | * An FileObject does not have children so this method returns allways NULL. |
||
85 | */ |
||
86 | public function getChildren(); |
||
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a ![]() |
|||
87 | |||
88 | /** |
||
89 | * Flushes the output to the file |
||
90 | * |
||
91 | * Forces a write of all buffered output to the file. |
||
92 | * |
||
93 | * @return Returns TRUE on success or FALSE on failure |
||
94 | */ |
||
95 | public function fflush(); |
||
96 | |||
97 | /** |
||
98 | * Gets character from file |
||
99 | * |
||
100 | * @return string|bool Returns a string containing a single character read |
||
101 | * from the file or FALSE on EOF. |
||
102 | */ |
||
103 | public function fgetc(); |
||
104 | |||
105 | /** |
||
106 | * Gets line from file |
||
107 | * |
||
108 | * @return string Returns a string containing the next line from the file, |
||
109 | * or FALSE on error. |
||
110 | */ |
||
111 | public function fgets(); |
||
112 | |||
113 | /** |
||
114 | * Gets line from file and strip HTML tags |
||
115 | * |
||
116 | * @param string $allowable_tags |
||
0 ignored issues
–
show
Should the type for parameter
$allowable_tags not be false|string ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
117 | * Optional parameter to specify tags which should not be stripped. |
||
118 | * |
||
119 | * @return string Returns a string containing the next line of the file |
||
120 | * with HTML and PHP code stripped, or FALSE on error. |
||
121 | */ |
||
122 | public function fgetss($allowable_tags = false); |
||
123 | |||
124 | /** |
||
125 | * Gets line from file and parse as CSV fields |
||
126 | * |
||
127 | * Gets a line from the file which is in CSV format and returns |
||
128 | * an array containing the fields read. |
||
129 | * |
||
130 | * @param string $delimiter |
||
131 | * The field delimiter (one character only). |
||
132 | * Defaults as a comma or the value set using FileObject::setCsvControl(). |
||
133 | * @param string $enclosure |
||
134 | * The field enclosure character (one character only). |
||
135 | * Defaults as a double quotation mark or the value set using FileObject::setCsvControl(). |
||
136 | * @param string $escape |
||
137 | * The escape character (one character only). |
||
138 | * Defaults as a backslash (\) or the value set using FileObject::setCsvControl(). |
||
139 | * |
||
140 | * @return array Returns an indexed array containing the fields read, or FALSE on error. |
||
141 | */ |
||
142 | public function fgetcsv($delimiter = ",", $enclosure = "\"", $escape = "\\"); |
||
143 | |||
144 | /** |
||
145 | * Write a field array as a CSV line |
||
146 | * |
||
147 | * @param array $fields |
||
148 | * An array of values. |
||
149 | * @param string $delimiter |
||
0 ignored issues
–
show
There is no parameter named
$delimiter . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
150 | * The optional delimiter parameter sets the field delimiter (one character only). |
||
151 | * @param string $enclosure |
||
0 ignored issues
–
show
There is no parameter named
$enclosure . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
152 | * The optional enclosure parameter sets the field enclosure (one character only). |
||
153 | * @param string $escape |
||
0 ignored issues
–
show
There is no parameter named
$escape . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
154 | * The optional escape parameter sets the escape character (one character only). |
||
155 | * |
||
156 | * @return int|bool Returns the length of the written string or FALSE on failure. |
||
157 | * returns FALSE, and does not write the CSV line to the file, if the delimiter |
||
158 | * or enclosure parameter is not a single character. |
||
159 | * |
||
160 | * $fields = [], $delimiter = ",", $enclosure = '"', $escape = "\\" |
||
161 | */ |
||
162 | public function fputcsv($fields); |
||
163 | |||
164 | /** |
||
165 | * Sets the delimiter and enclosure character for parsing CSV fields. |
||
166 | * |
||
167 | * @param string $delimiter |
||
168 | * The field delimiter (one character only). |
||
169 | * @param string $enclosure |
||
170 | * The field enclosure character (one character only). |
||
171 | * @param string $escape |
||
172 | * The field escape character (one character only). |
||
173 | * @return void |
||
174 | */ |
||
175 | public function setCsvControl($delimiter = ",", $enclosure = "\"", $escape = "\\"); |
||
176 | |||
177 | /** |
||
178 | * Output all remaining data on a file pointer |
||
179 | * |
||
180 | * Reads to EOF on the given file pointer from the current position and |
||
181 | * writes the results to the output buffer. You may need to call FileObject::rewind() |
||
182 | * to reset the file pointer to the beginning of the file if you have already written data to the file. |
||
183 | * |
||
184 | * @return int Returns the number of characters read from handle and passed through to the output. |
||
185 | */ |
||
186 | public function fpassthru(); |
||
187 | |||
188 | /** |
||
189 | * Reads the given number or all of bytes from the file. |
||
190 | * |
||
191 | * @param int $length |
||
192 | * The number of bytes to read. |
||
193 | * @return string|bool Returns the string read from the file or FALSE on failure. |
||
194 | */ |
||
195 | public function fread($length); |
||
196 | |||
197 | /** |
||
198 | * Parses input from file according to a format |
||
199 | * |
||
200 | * Reads a line from the file and interprets it according to the specified format, |
||
201 | * which is described in the documentation for sprintf(). Any whitespace in the format |
||
202 | * string matches any whitespace in the line from the file. This means that even |
||
203 | * a tab \t in the format string can match a single space character in the input stream. |
||
204 | * |
||
205 | * @param unknown $format |
||
206 | * The specified format as described in the sprintf() documentation. |
||
207 | * @return array|int If only one parameter is passed to this method, |
||
208 | * the values parsed will be returned as an array. Otherwise, if optional parameters are passed, |
||
209 | * the function will return the number of assigned values. The optional parameters must be passed by reference. |
||
210 | * |
||
211 | */ |
||
212 | public function fscanf($format); |
||
213 | |||
214 | /** |
||
215 | * Seek to a position |
||
216 | * |
||
217 | * Seek to a position in the file measured in bytes from the beginning of the file, |
||
218 | * obtained by adding offset to the position specified by whence. |
||
219 | * |
||
220 | * @param unknown $offset |
||
221 | * The offset. A negative value can be used to move backwards through the |
||
222 | * file which is useful when SEEK_END is used as the whence value. |
||
223 | * @param string $whence |
||
224 | * whence values are: |
||
225 | * |
||
226 | * SEEK_SET - Set position equal to offset bytes. |
||
227 | * SEEK_CUR - Set position to current location plus offset. |
||
228 | * SEEK_END - Set position to end-of-file plus offset. |
||
229 | * |
||
230 | * If whence is not specified, it is assumed to be SEEK_SET. |
||
231 | * |
||
232 | * @return int Returns 0 if the seek was successful, -1 otherwise. |
||
233 | * Note that seeking past EOF is not considered an error. |
||
234 | */ |
||
235 | public function fseek($offset, $whence = SEEK_SET); |
||
236 | |||
237 | /** |
||
238 | * Gets information about the file |
||
239 | * Gathers the statistics of the file. |
||
240 | * Behaves identically to fstat(). |
||
241 | * |
||
242 | * @return array Returns an array with the statistics of the file; |
||
243 | * the format of the array is described in detail on the stat() manual page. |
||
244 | */ |
||
245 | public function fstat(); |
||
246 | |||
247 | /** |
||
248 | * Return current file position |
||
249 | * |
||
250 | * Returns the position of the file pointer which represents the current offset in the file stream. |
||
251 | * |
||
252 | * @return int Returns the position of the file pointer as an integer, or FALSE on error. |
||
253 | */ |
||
254 | public function ftell(); |
||
255 | |||
256 | /** |
||
257 | * Truncates the file to a given lengthm to size bytes. |
||
258 | * |
||
259 | * |
||
260 | * @param int $size |
||
261 | * If size is larger than the file it is extended with null bytes. |
||
262 | * If size is smaller than the file, the extra data will be lost. |
||
263 | * |
||
264 | * @return bool Returns TRUE on success or FALSE on failure. |
||
265 | */ |
||
266 | public function ftruncate($size); |
||
267 | |||
268 | /** |
||
269 | * Writes the contents of string to the file |
||
270 | * |
||
271 | * @param string $str |
||
272 | * The string to be written to the file. |
||
273 | * @param int $length |
||
0 ignored issues
–
show
Should the type for parameter
$length not be false|integer ?
This check looks for It makes a suggestion as to what type it considers more descriptive. Most often this is a case of a parameter that can be null in addition to its declared types. ![]() |
|||
274 | * If the length argument is given, writing will stop after |
||
275 | * length bytes have been written or the end of string is reached, whichever comes first. |
||
276 | * |
||
277 | * @return int Returns the number of bytes written, or NULL on error. |
||
278 | */ |
||
279 | public function fwrite($str, $length = false); |
||
280 | |||
281 | /** |
||
282 | * Get the delimiter and enclosure character for CSV |
||
283 | * |
||
284 | * @return array Returns an indexed array containing the delimiter and enclosure character. |
||
285 | */ |
||
286 | public function getCsvControl(); |
||
287 | |||
288 | /** |
||
289 | * Alias of FileObject::fgets() |
||
290 | */ |
||
291 | public function getCurrentLine(); |
||
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a ![]() |
|||
292 | |||
293 | /** |
||
294 | * Gets flags for the FileObject |
||
295 | * gets the flags set for an instance of FileObject as an integer. |
||
296 | * |
||
297 | * @return int Returns an integer representing the flags. |
||
298 | */ |
||
299 | public function getFlags(); |
||
300 | |||
301 | /** |
||
302 | * Get maximum line length |
||
303 | * Gets the maximum line length as set by FileObject::setMaxLineLen(). |
||
304 | * |
||
305 | * |
||
306 | * @return int Returns the maximum line length if one has been set with FileObject::setMaxLineLen(), default is 0. |
||
307 | */ |
||
308 | public function getMaxLineLen(); |
||
309 | |||
310 | /** |
||
311 | * Get line number |
||
312 | * This number may not reflect the actual line number in the file if |
||
313 | * FileObject::setMaxLineLen() is used to read fixed lengths of the file. |
||
314 | * |
||
315 | * |
||
316 | * @return Returns the current line number. |
||
317 | */ |
||
318 | public function key(); |
||
319 | |||
320 | /** |
||
321 | * Moves ahead to the next line in the file. |
||
322 | * |
||
323 | * @return void |
||
324 | */ |
||
325 | public function next(); |
||
326 | |||
327 | /** |
||
328 | * Rewinds the file back to the first line. |
||
329 | * |
||
330 | * @return void |
||
331 | */ |
||
332 | public function rewind(); |
||
333 | |||
334 | /** |
||
335 | * Seek to specified line |
||
336 | * |
||
337 | * @param int $line_pos |
||
338 | * The zero-based line number to seek to. |
||
339 | * @return void |
||
340 | */ |
||
341 | public function seek($line_pos); |
||
342 | |||
343 | /** |
||
344 | * Sets flags for the FileObject |
||
345 | * |
||
346 | * @param int $flags |
||
347 | * Bit mask of the flags to set. See FileObject constants for the available flags. |
||
348 | * @return void |
||
349 | */ |
||
350 | public function setFlags($flags); |
||
351 | |||
352 | /** |
||
353 | * Sets the maximum length of a line to be read. |
||
354 | * |
||
355 | * @param int $max_len |
||
356 | * The maximum length of a line. |
||
357 | * @return void |
||
358 | * |
||
359 | */ |
||
360 | public function setMaxLineLen($max_len); |
||
361 | |||
362 | /** |
||
363 | * Alias of FileObject::current() |
||
364 | */ |
||
365 | public function __toString(); |
||
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a ![]() |
|||
366 | |||
367 | /** |
||
368 | * Check whether EOF has been reached. |
||
369 | * |
||
370 | * @return bool Returns TRUE if not reached EOF, FALSE otherwise. |
||
371 | */ |
||
372 | public function valid(); |
||
373 | } |
||
374 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.