Issues (265)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Filesystem.php (82 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace PHP\Wrappers;
4
5
/**
6
 * Class Filesystem
7
 *
8
 * @package PHP\Wrappers
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
class Filesystem
12
{
13
    /**
14
     * Returns trailing name component of path
15
     *
16
     * @param string $path   A path.
17
     * @param string $suffix If the name component ends in suffix this will also
18
     *                       be cut off.
19
     *
20
     * @return string
21
     */
22
    public function basename(string $path, string $suffix = null) : string
0 ignored issues
show
The parameter $path is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $suffix is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        return call_user_func_array('basename', func_get_args());
25
    }
26
27
    /**
28
     * Changes file group
29
     *
30
     * @param string $filename Path to the file.
31
     * @param mixed  $group    A group name or number.
32
     *
33
     * @return bool
34
     */
35
    public function chgrp(string $filename, $group) : bool
36
    {
37
        return chgrp($filename, $group);
38
    }
39
40
    /**
41
     * Changes file mode
42
     *
43
     * @param string $filename Path to the file.
44
     * @param int    $mode     Note that mode is not automatically
45
     *                         assumed to be an octal value, so to ensure the expected operation,
46
     *                         you need to prefix mode with a zero (0).
47
     *                         Strings such as "g+w" will not work properly.
48
     *
49
     * @return bool
50
     */
51
    public function chmod(string $filename, int $mode) : bool
52
    {
53
        return chmod($filename, $mode);
54
    }
55
56
    /**
57
     * Changes file owner
58
     *
59
     * @param string $filename Path to the file.
60
     * @param mixed  $user     A user name or number.
61
     *
62
     * @return bool
63
     */
64
    public function chown(string $filename, $user) : bool
65
    {
66
        return chown($filename, $user);
67
    }
68
69
    /**
70
     * Clears file status cache
71
     *
72
     * @param bool   $clearRealpathCache Whether to clear the realpath cache or not.
73
     * @param string $filename           Clear the realpath and the stat cache for a specific filename only; only
74
     *                                   used if $clearRealpathCache is .
75
     *
76
     * @return void
77
     */
78
    public function clearStatCache(bool $clearRealpathCache = null, string $filename = null)
0 ignored issues
show
The parameter $clearRealpathCache is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
79
    {
80
        call_user_func_array('clearstatcache', func_get_args());
81
    }
82
83
    /**
84
     * Copies file
85
     *
86
     * @param string   $source  Path to the source file.
87
     * @param string   $dest    The destination path. If dest is a URL, the
88
     *                          copy operation may fail if the wrapper does not support overwriting of
89
     *                          existing files.
90
     * @param resource $context A valid context resource created with
91
     *                          stream_context_create.
92
     *
93
     * @return bool
94
     */
95
    public function copy(string $source, string $dest, $context = null) : bool
0 ignored issues
show
The parameter $source is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $dest is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
96
    {
97
        return call_user_func_array('copy', func_get_args());
98
    }
99
100
    /**
101
     * Returns a parent directory's path
102
     *
103
     * @param string $path   A path.
104
     * @param int    $levels The number of parent directories to go up.
105
     *
106
     * @return string
107
     */
108
    public function dirName(string $path, int $levels = null) : string
0 ignored issues
show
The parameter $path is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $levels is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
109
    {
110
        return call_user_func_array('dirname', func_get_args());
111
    }
112
113
    /**
114
     * Returns available space on filesystem or disk partition
115
     *
116
     * @param string $directory A directory of the filesystem or disk partition.
117
     *
118
     * @return float
119
     */
120
    public function diskFreeSpace(string $directory) : float
121
    {
122
        return disk_free_space($directory);
123
    }
124
125
    /**
126
     * Returns the total size of a filesystem or disk partition
127
     *
128
     * @param string $directory A directory of the filesystem or disk partition.
129
     *
130
     * @return float
131
     */
132
    public function diskTotalSpace(string $directory) : float
133
    {
134
        return disk_total_space($directory);
135
    }
136
137
    /**
138
     * Closes an open file pointer
139
     *
140
     * @param resource $handle The file pointer must be valid, and must point to a file successfully
141
     *                         opened by fopen or fsockopen.
142
     *
143
     * @return bool
144
     */
145
    public function fclose($handle) : bool
146
    {
147
        return fclose($handle);
148
    }
149
150
    /**
151
     * Tests for end-of-file on a file pointer
152
     *
153
     * @param resource $handle
154
     *
155
     * @return bool
156
     */
157
    public function feof($handle) : bool
158
    {
159
        return feof($handle);
160
    }
161
162
    /**
163
     * Flushes the output to a file
164
     *
165
     * @param resource $handle
166
     *
167
     * @return bool
168
     */
169
    public function fflush($handle) : bool
170
    {
171
        return fflush($handle);
172
    }
173
174
    /**
175
     * Gets character from file pointer
176
     *
177
     * @param resource $handle
178
     *
179
     * @return string
180
     */
181
    public function fgetc($handle) : string
182
    {
183
        return fgetc($handle);
184
    }
185
186
    /**
187
     * Gets line from file pointer and parse for CSV fields
188
     *
189
     * @param resource $handle    A valid file pointer to a file successfully opened by
190
     *                            fopen, popen, or
191
     *                            fsockopen.
192
     * @param int      $length    Must be greater than the longest line (in characters) to be found in
193
     *                            the CSV file (allowing for trailing line-end characters). It became
194
     *                            optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP
195
     *                            5.1.0 and later) the maximum line length is not limited, which is
196
     *                            slightly slower.
197
     * @param string   $delimiter The optional delimiter parameter sets the field delimiter (one character only).
198
     * @param string   $enclosure The optional enclosure parameter sets the field enclosure character (one character
199
     *                            only).
200
     * @param string   $escape    The optional escape parameter sets the escape character (one character only).
201
     *
202
     * @return array
203
     */
204
    public function fgetcsv(
205
        $handle,
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
206
        int $length = null,
0 ignored issues
show
The parameter $length is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
207
        string $delimiter = null,
0 ignored issues
show
The parameter $delimiter is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
208
        string $enclosure = null,
0 ignored issues
show
The parameter $enclosure is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
209
        string $escape = null
0 ignored issues
show
The parameter $escape is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
210
    ) : array {
211
        return call_user_func_array('fgetcsv', func_get_args());
212
    }
213
214
    /**
215
     * Gets line from file pointer
216
     *
217
     * @param resource $handle
218
     * @param int      $length Reading ends when length - 1 bytes have been
219
     *                         read, or a newline (which is included in the return value), or an EOF
220
     *                         (whichever comes first). If no length is specified, it will keep
221
     *                         reading from the stream until it reaches the end of the line.
222
     *
223
     * @return string
224
     */
225
    public function fgets($handle, int $length = null) : string
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $length is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
226
    {
227
        return call_user_func_array('fgets', func_get_args());
228
    }
229
230
    /**
231
     * Gets line from file pointer and strip HTML tags
232
     *
233
     * @param resource $handle
234
     * @param int      $length        Length of the data to be retrieved.
235
     * @param string   $allowableTags You can use the optional third parameter to specify tags which should
236
     *                                not be stripped.
237
     *
238
     * @return string
239
     */
240
    public function fgetss($handle, int $length = null, string $allowableTags = null) : string
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $length is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $allowableTags is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
241
    {
242
        return call_user_func_array('fgetss', func_get_args());
243
    }
244
245
    /**
246
     * Checks whether a file or directory exists
247
     *
248
     * @param string $filename Path to the file or directory.
249
     *
250
     * @return bool
251
     */
252
    public function fileExists(string $filename) : bool
253
    {
254
        return file_exists($filename);
255
    }
256
257
    /**
258
     * Reads entire file into a string
259
     *
260
     * @param string   $filename Name of the file to read.
261
     * @param bool     $useIncludePath
262
     * @param resource $context  A valid context resource created with
263
     *                           stream_context_create. If you don't need to use a
264
     *                           custom context, you can skip this parameter by .
265
     * @param int      $offset   The offset where the reading starts on the original stream.
266
     * @param int      $maxlen   Maximum length of data read. The default is to read until end
267
     *                           of file is reached. Note that this parameter is applied to the
268
     *                           stream processed by the filters.
269
     *
270
     * @return string
271
     */
272
    public function fileGetContents(
273
        string $filename,
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
274
        bool $useIncludePath = null,
0 ignored issues
show
The parameter $useIncludePath is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
275
        $context = null,
0 ignored issues
show
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
276
        int $offset = null,
0 ignored issues
show
The parameter $offset is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
277
        int $maxlen = null
0 ignored issues
show
The parameter $maxlen is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
278
    ) : string {
279
        return call_user_func_array('file_get_contents', func_get_args());
280
    }
281
282
    /**
283
     * Write a string to a file
284
     *
285
     * @param string   $filename Path to the file where to write the data.
286
     * @param mixed    $data     The data to write. Can be either a string, an
287
     *                           array or a stream resource.
288
     * @param int      $flags    The value of flags can be any combination of
289
     *                           the following flags, joined with the binary OR (|)
290
     *                           operator.
291
     * @param resource $context  A valid context resource created with
292
     *                           stream_context_create.
293
     *
294
     * @return int
295
     */
296
    public function filePutContents(string $filename, $data, int $flags = null, $context = null) : int
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $data is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $flags is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
297
    {
298
        return call_user_func_array('file_put_contents', func_get_args());
299
    }
300
301
    /**
302
     * Reads entire file into an array
303
     *
304
     * @param string   $filename Path to the file.
305
     * @param int      $flags    The optional parameter flags can be one, or
306
     *                           more, of the following constants:
307
     *
308
     *
309
     *
310
     * FILE_USE_INCLUDE_PATH
311
     *
312
     *
313
     *
314
     * Search for the file in the include_path.
315
     *
316
     *
317
     *
318
     *
319
     *
320
     * FILE_IGNORE_NEW_LINES
321
     *
322
     *
323
     *
324
     * Do not add newline at the end of each array element
325
     *
326
     *
327
     *
328
     *
329
     *
330
     * FILE_SKIP_EMPTY_LINES
331
     *
332
     *
333
     *
334
     * Skip empty lines
335
     * @param resource $context  A context resource created with the
336
     *                           stream_context_create function.
337
     *
338
     * @return array
339
     */
340
    public function file(string $filename, int $flags = null, $context = null) : array
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $flags is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
341
    {
342
        return call_user_func_array('file', func_get_args());
343
    }
344
345
    /**
346
     * Gets last access time of file
347
     *
348
     * @param string $filename Path to the file.
349
     *
350
     * @return int
351
     */
352
    public function fileatime(string $filename) : int
353
    {
354
        return fileatime($filename);
355
    }
356
357
    /**
358
     * Gets inode change time of file
359
     *
360
     * @param string $filename Path to the file.
361
     *
362
     * @return int
363
     */
364
    public function filectime(string $filename) : int
365
    {
366
        return filectime($filename);
367
    }
368
369
    /**
370
     * Gets file group
371
     *
372
     * @param string $filename Path to the file.
373
     *
374
     * @return int
375
     */
376
    public function fileroup(string $filename) : int
377
    {
378
        return filegroup($filename);
379
    }
380
381
    /**
382
     * Gets file inode
383
     *
384
     * @param string $filename Path to the file.
385
     *
386
     * @return int
387
     */
388
    public function fileinode(string $filename) : int
389
    {
390
        return fileinode($filename);
391
    }
392
393
    /**
394
     * Gets file modification time
395
     *
396
     * @param string $filename Path to the file.
397
     *
398
     * @return int
399
     */
400
    public function filemtime(string $filename) : int
401
    {
402
        return filemtime($filename);
403
    }
404
405
    /**
406
     * Gets file owner
407
     *
408
     * @param string $filename Path to the file.
409
     *
410
     * @return int
411
     */
412
    public function fileowner(string $filename) : int
413
    {
414
        return fileowner($filename);
415
    }
416
417
    /**
418
     * Gets file permissions
419
     *
420
     * @param string $filename Path to the file.
421
     *
422
     * @return int
423
     */
424
    public function fileperms(string $filename) : int
425
    {
426
        return fileperms($filename);
427
    }
428
429
    /**
430
     * Gets file size
431
     *
432
     * @param string $filename Path to the file.
433
     *
434
     * @return int
435
     */
436
    public function filesize(string $filename) : int
437
    {
438
        return filesize($filename);
439
    }
440
441
    /**
442
     * Gets file type
443
     *
444
     * @param string $filename Path to the file.
445
     *
446
     * @return string
447
     */
448
    public function filetype(string $filename) : string
449
    {
450
        return filetype($filename);
451
    }
452
453
    /**
454
     * Portable advisory file locking
455
     *
456
     * @param resource $handle
457
     * @param int      $operation  operation is one of the following:
458
     *
459
     *
460
     *
461
     * LOCK_SH to acquire a shared lock (reader).
462
     *
463
     *
464
     *
465
     *
466
     * LOCK_EX to acquire an exclusive lock (writer).
467
     *
468
     *
469
     *
470
     *
471
     * LOCK_UN to release a lock (shared or exclusive).
472
     * @param int      $wouldblock The optional third argument is set to 1 if the lock would block
473
     *                             (EWOULDBLOCK errno condition).
474
     *
475
     * @return bool
476
     */
477
    public function flock($handle, int $operation, int &$wouldblock = null) : bool
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $operation is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $wouldblock is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
478
    {
479
        return call_user_func_array('flock', func_get_args());
480
    }
481
482
    /**
483
     * Match filename against a pattern
484
     *
485
     * @param string $pattern The shell wildcard pattern.
486
     * @param string $string  The tested string. This function is especially useful for filenames,
487
     *                        but may also be used on regular strings.
488
     * @param int    $flags   The value of flags can be any combination of
489
     *                        the following flags, joined with the
490
     *                        binary OR (|) operator.
491
     *
492
     *
493
     * A list of possible flags for fnmatch
494
     *
495
     *
496
     *
497
     *
498
     * Flag
499
     * Description
500
     *
501
     *
502
     *
503
     *
504
     * FNM_NOESCAPE
505
     *
506
     * Disable backslash escaping.
507
     *
508
     *
509
     *
510
     * FNM_PATHNAME
511
     *
512
     * Slash in string only matches slash in the given pattern.
513
     *
514
     *
515
     *
516
     * FNM_PERIOD
517
     *
518
     * Leading period in string must be exactly matched by period in the given pattern.
519
     *
520
     *
521
     *
522
     * FNM_CASEFOLD
523
     *
524
     * Caseless match. Part of the GNU extension.
525
     *
526
     * @return bool
527
     */
528
    public function fnmatch(string $pattern, string $string, int $flags = null) : bool
0 ignored issues
show
The parameter $pattern is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $string is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $flags is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
529
    {
530
        return call_user_func_array('fnmatch', func_get_args());
531
    }
532
533
    /**
534
     * Opens file or URL
535
     *
536
     * @param string   $filename       If filename is of the form "scheme://...", it
537
     *                                 is assumed to be a URL and PHP will search for a protocol handler
538
     *                                 (also known as a wrapper) for that scheme. If no wrappers for that
539
     *                                 protocol are registered, PHP will emit a notice to help you track
540
     *                                 potential problems in your script and then continue as though
541
     *                                 filename specifies a regular file.
542
     * @param string   $mode           The mode parameter specifies the type of access
543
     *                                 you require to the stream.  It may be any of the following:
544
     *
545
     *
546
     * A list of possible modes for fopen
547
     * using mode
548
     *
549
     *
550
     *
551
     *
552
     * mode
553
     * Description
554
     *
555
     *
556
     *
557
     *
558
     * 'r'
559
     *
560
     * Open for reading only; place the file pointer at the
561
     * beginning of the file.
562
     *
563
     *
564
     *
565
     * 'r+'
566
     *
567
     * Open for reading and writing; place the file pointer at
568
     * the beginning of the file.
569
     *
570
     *
571
     *
572
     * 'w'
573
     *
574
     * Open for writing only; place the file pointer at the
575
     * beginning of the file and truncate the file to zero length.
576
     * If the file does not exist, attempt to create it.
577
     *
578
     *
579
     *
580
     * 'w+'
581
     *
582
     * Open for reading and writing; place the file pointer at
583
     * the beginning of the file and truncate the file to zero
584
     * length.  If the file does not exist, attempt to create it.
585
     *
586
     *
587
     *
588
     * 'a'
589
     *
590
     * Open for writing only; place the file pointer at the end of
591
     * the file. If the file does not exist, attempt to create it.
592
     * In this mode, fseek only affects
593
     * the reading position, writes are always appended.
594
     *
595
     *
596
     *
597
     * 'a+'
598
     *
599
     * Open for reading and writing; place the file pointer at
600
     * the end of the file. If the file does not exist, attempt to
601
     * create it. In this mode, fseek only affects
602
     * the reading position, writes are always appended.
603
     *
604
     *
605
     *
606
     * 'x'
607
     *
608
     * Create and open for writing only; place the file pointer at the
609
     * beginning of the file.  If the file already exists, the
610
     * fopen call will fail by returning  and
611
     * generating an error of level E_WARNING.  If
612
     * the file does not exist, attempt to create it.  This is equivalent
613
     * to specifying O_EXCL|O_CREAT flags for the
614
     * underlying open(2) system call.
615
     *
616
     *
617
     *
618
     * 'x+'
619
     *
620
     * Create and open for reading and writing; otherwise it has the
621
     * same behavior as 'x'.
622
     *
623
     *
624
     *
625
     * 'c'
626
     *
627
     * Open the file for writing only. If the file does not exist, it is
628
     * created. If it exists, it is neither truncated (as opposed to
629
     * 'w'), nor the call to this function fails (as is
630
     * the case with 'x'). The file pointer is
631
     * positioned on the beginning of the file. This may be useful if it's
632
     * desired to get an advisory lock (see flock)
633
     * before attempting to modify the file, as using
634
     * 'w' could truncate the file before the lock
635
     * was obtained (if truncation is desired,
636
     * ftruncate can be used after the lock is
637
     * requested).
638
     *
639
     *
640
     *
641
     * 'c+'
642
     *
643
     * Open the file for reading and writing; otherwise it has the same
644
     * behavior as 'c'.
645
     * @param bool     $useIncludePath The optional third use_include_path parameter
646
     *                                 can be set to '1' or  if you want to search for the file in the
647
     *                                 include_path, too.
648
     * @param resource $context
649
     *
650
     * @return resource
651
     */
652
    public function fopen(string $filename, string $mode, bool $useIncludePath = null, $context = null)
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $mode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $useIncludePath is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
653
    {
654
        return call_user_func_array('fopen', func_get_args());
655
    }
656
657
    /**
658
     * Output all remaining data on a file pointer
659
     *
660
     * @param resource $handle
661
     *
662
     * @return int
663
     */
664
    public function fpassthru($handle) : int
665
    {
666
        return fpassthru($handle);
667
    }
668
669
    /**
670
     * Format line as CSV and write to file pointer
671
     *
672
     * @param resource $handle
673
     * @param array    $fields     An array of values.
674
     * @param string   $delimiter  The optional delimiter parameter sets the field
675
     *                             delimiter (one character only).
676
     * @param string   $enclosure  The optional enclosure parameter sets the field
677
     *                             enclosure (one character only).
678
     * @param string   $escapeChar The optional escape_char parameter sets the
679
     *                             escape character (one character only).
680
     *
681
     * @return int
682
     */
683
    public function fputcsv(
684
        $handle,
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
685
        array $fields,
0 ignored issues
show
The parameter $fields is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
686
        string $delimiter = null,
0 ignored issues
show
The parameter $delimiter is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
687
        string $enclosure = null,
0 ignored issues
show
The parameter $enclosure is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
688
        string $escapeChar = null
0 ignored issues
show
The parameter $escapeChar is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
689
    ) : int {
690
        return call_user_func_array('fputcsv', func_get_args());
691
    }
692
693
    /**
694
     * Binary-safe file read
695
     *
696
     * @param resource $handle
697
     * @param int      $length Up to length number of bytes read.
698
     *
699
     * @return string
700
     */
701
    public function fread($handle, int $length) : string
702
    {
703
        return fread($handle, $length);
704
    }
705
706
    /**
707
     * Parses input from a file according to a format
708
     *
709
     * @param resource $handle
710
     * @param string   $format The specified format as described in the
711
     *                         sprintf documentation.
712
     *
713
     * @return mixed
714
     */
715
    public function fscanf($handle, string $format)
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $format is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
716
    {
717
        return call_user_func_array('fscanf', func_get_args());
718
    }
719
720
    /**
721
     * Seeks on a file pointer
722
     *
723
     * @param resource $handle
724
     * @param int      $offset The offset.
725
     * @param int      $whence whence values are:
726
     *
727
     * SEEK_SET - Set position equal to offset bytes.
728
     * SEEK_CUR - Set position to current location plus offset.
729
     * SEEK_END - Set position to end-of-file plus offset.
730
     *
731
     * @return int
732
     */
733
    public function fseek($handle, int $offset, int $whence = null) : int
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $offset is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $whence is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
734
    {
735
        return call_user_func_array('fseek', func_get_args());
736
    }
737
738
    /**
739
     * Gets information about a file using an open file pointer
740
     *
741
     * @param resource $handle
742
     *
743
     * @return array
744
     */
745
    public function fstat($handle) : array
746
    {
747
        return fstat($handle);
748
    }
749
750
    /**
751
     * Returns the current position of the file read/write pointer
752
     *
753
     * @param resource $handle The file pointer must be valid, and must point to a file successfully
754
     *                         opened by fopen or popen.
755
     *                         ftell gives undefined results for append-only streams
756
     *                         (opened with "a" flag).
757
     *
758
     * @return int
759
     */
760
    public function ftell($handle) : int
761
    {
762
        return ftell($handle);
763
    }
764
765
    /**
766
     * Truncates a file to a given length
767
     *
768
     * @param resource $handle The file pointer.
769
     * @param int      $size   The size to truncate to.
770
     *
771
     * @return bool
772
     */
773
    public function ftruncate($handle, int $size) : bool
774
    {
775
        return ftruncate($handle, $size);
776
    }
777
778
    /**
779
     * Binary-safe file write
780
     *
781
     * @param resource $handle
782
     * @param string   $string The string that is to be written.
783
     * @param int      $length If the length argument is given, writing will
784
     *                         stop after length bytes have been written or
785
     *                         the end of string is reached, whichever comes
786
     *                         first.
787
     *
788
     * @return int
789
     */
790
    public function fwrite($handle, string $string, int $length = null) : int
0 ignored issues
show
The parameter $handle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $string is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $length is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
791
    {
792
        return call_user_func_array('fwrite', func_get_args());
793
    }
794
795
    /**
796
     * Find pathnames matching a pattern
797
     *
798
     * @param string $pattern The pattern. No tilde expansion or parameter substitution is done.
799
     * @param int    $flags   Valid flags:
800
     *
801
     *
802
     *
803
     * GLOB_MARK - Adds a slash to each directory returned
804
     *
805
     *
806
     *
807
     *
808
     * GLOB_NOSORT - Return files as they appear in the
809
     * directory (no sorting). When this flag is not used, the pathnames are
810
     * sorted alphabetically
811
     *
812
     *
813
     *
814
     *
815
     * GLOB_NOCHECK - Return the search pattern if no
816
     * files matching it were found
817
     *
818
     *
819
     *
820
     *
821
     * GLOB_NOESCAPE - Backslashes do not quote
822
     * metacharacters
823
     *
824
     *
825
     *
826
     *
827
     * GLOB_BRACE - Expands {a,b,c} to match 'a', 'b',
828
     * or 'c'
829
     *
830
     *
831
     *
832
     *
833
     * GLOB_ONLYDIR - Return only directory entries
834
     * which match the pattern
835
     *
836
     *
837
     *
838
     *
839
     * GLOB_ERR - Stop on read errors (like unreadable
840
     * directories), by default errors are ignored.
841
     *
842
     * @return array
843
     */
844
    public function glob(string $pattern, int $flags = null) : array
0 ignored issues
show
The parameter $pattern is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $flags is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
845
    {
846
        return call_user_func_array('glob', func_get_args());
847
    }
848
849
    /**
850
     * Tells whether the filename is a directory
851
     *
852
     * @param string $filename Path to the file. If filename is a relative
853
     *                         filename, it will be checked relative to the current working
854
     *                         directory. If filename is a symbolic or hard link
855
     *                         then the link will be resolved and checked. If you have enabled ,
856
     *                         or open_basedir further
857
     *                         restrictions may apply.
858
     *
859
     * @return bool
860
     */
861
    public function isDir(string $filename) : bool
862
    {
863
        return is_dir($filename);
864
    }
865
866
    /**
867
     * Tells whether the filename is executable
868
     *
869
     * @param string $filename Path to the file.
870
     *
871
     * @return bool
872
     */
873
    public function isExecutable(string $filename) : bool
874
    {
875
        return is_executable($filename);
876
    }
877
878
    /**
879
     * Tells whether the filename is a regular file
880
     *
881
     * @param string $filename Path to the file.
882
     *
883
     * @return bool
884
     */
885
    public function isFile(string $filename) : bool
886
    {
887
        return is_file($filename);
888
    }
889
890
    /**
891
     * Tells whether the filename is a symbolic link
892
     *
893
     * @param string $filename Path to the file.
894
     *
895
     * @return bool
896
     */
897
    public function isLink(string $filename) : bool
898
    {
899
        return is_link($filename);
900
    }
901
902
    /**
903
     * Tells whether a file exists and is readable
904
     *
905
     * @param string $filename Path to the file.
906
     *
907
     * @return bool
908
     */
909
    public function isReadable(string $filename) : bool
910
    {
911
        return is_readable($filename);
912
    }
913
914
    /**
915
     * Tells whether the file was uploaded via HTTP POST
916
     *
917
     * @param string $filename The filename being checked.
918
     *
919
     * @return bool
920
     */
921
    public function isUploadedFile(string $filename) : bool
922
    {
923
        return is_uploaded_file($filename);
924
    }
925
926
    /**
927
     * Tells whether the filename is writable
928
     *
929
     * @param string $filename The filename being checked.
930
     *
931
     * @return bool
932
     */
933
    public function isWritable(string $filename) : bool
934
    {
935
        return is_writable($filename);
936
    }
937
938
    /**
939
     * Changes group ownership of symlink
940
     *
941
     * @param string $filename Path to the symlink.
942
     * @param mixed  $group    The group specified by name or number.
943
     *
944
     * @return bool
945
     */
946
    public function lchgrp(string $filename, $group) : bool
947
    {
948
        return lchgrp($filename, $group);
949
    }
950
951
    /**
952
     * Changes user ownership of symlink
953
     *
954
     * @param string $filename Path to the file.
955
     * @param mixed  $user     User name or number.
956
     *
957
     * @return bool
958
     */
959
    public function lchown(string $filename, $user) : bool
960
    {
961
        return lchown($filename, $user);
962
    }
963
964
    /**
965
     * Create a hard link
966
     *
967
     * @param string $target Target of the link.
968
     * @param string $link   The link name.
969
     *
970
     * @return bool
971
     */
972
    public function link(string $target, string $link) : bool
973
    {
974
        return link($target, $link);
975
    }
976
977
    /**
978
     * Gets information about a link
979
     *
980
     * @param string $path Path to the link.
981
     *
982
     * @return int
983
     */
984
    public function linkinfo(string $path) : int
985
    {
986
        return linkinfo($path);
987
    }
988
989
    /**
990
     * Gives information about a file or symbolic link
991
     *
992
     * @param string $filename Path to a file or a symbolic link.
993
     *
994
     * @return array
995
     */
996
    public function lstat(string $filename) : array
997
    {
998
        return lstat($filename);
999
    }
1000
1001
    /**
1002
     * Makes directory
1003
     *
1004
     * @param string   $pathname  The directory path.
1005
     * @param int      $mode      The mode is 0777 by default, which means the widest possible
1006
     *                            access. For more information on modes, read the details
1007
     *                            on the chmod page.
1008
     * @param bool     $recursive Allows the creation of nested directories specified in the
1009
     *                            pathname.
1010
     * @param resource $context
1011
     *
1012
     * @return bool
1013
     */
1014
    public function mkdir(string $pathname, int $mode = null, bool $recursive = null, $context = null) : bool
0 ignored issues
show
The parameter $pathname is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $mode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $recursive is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1015
    {
1016
        return call_user_func_array('mkdir', func_get_args());
1017
    }
1018
1019
    /**
1020
     * Moves an uploaded file to a new location
1021
     *
1022
     * @param string $filename    The filename of the uploaded file.
1023
     * @param string $destination The destination of the moved file.
1024
     *
1025
     * @return bool
1026
     */
1027
    public function moveUploadedFile(string $filename, string $destination) : bool
1028
    {
1029
        return move_uploaded_file($filename, $destination);
1030
    }
1031
1032
    /**
1033
     * Parse a configuration file
1034
     *
1035
     * @param string $filename        The filename of the ini file being parsed.
1036
     * @param bool   $processSections By setting the process_sections
1037
     *                                parameter to , you get a multidimensional array, with
1038
     *                                the section names and settings included. The default
1039
     *                                for process_sections is
1040
     * @param int    $scannerMode     Can either be INI_SCANNER_NORMAL (default) or
1041
     *                                INI_SCANNER_RAW. If INI_SCANNER_RAW
1042
     *                                is supplied, then option values will not be parsed.
1043
     *
1044
     * @return array
1045
     */
1046
    public function parseIniFile(string $filename, bool $processSections = null, int $scannerMode = null) : array
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $processSections is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $scannerMode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1047
    {
1048
        return call_user_func_array('parse_ini_file', func_get_args());
1049
    }
1050
1051
    /**
1052
     * Parse a configuration string
1053
     *
1054
     * @param string $ini             The contents of the ini file being parsed.
1055
     * @param bool   $processSections By setting the process_sections
1056
     *                                parameter to , you get a multidimensional array, with
1057
     *                                the section names and settings included. The default
1058
     *                                for process_sections is
1059
     * @param int    $scannerMode     Can either be INI_SCANNER_NORMAL (default) or
1060
     *                                INI_SCANNER_RAW. If INI_SCANNER_RAW
1061
     *                                is supplied, then option values will not be parsed.
1062
     *
1063
     * @return array
1064
     */
1065
    public function parseIniString(string $ini, bool $processSections = null, int $scannerMode = null) : array
0 ignored issues
show
The parameter $ini is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $processSections is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $scannerMode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1066
    {
1067
        return call_user_func_array('parse_ini_string', func_get_args());
1068
    }
1069
1070
    /**
1071
     * Returns information about a file path
1072
     *
1073
     * @param string $path    The path to be parsed.
1074
     * @param int    $options If present, specifies a specific element to be returned; one of
1075
     *                        PATHINFO_DIRNAME,
1076
     *                        PATHINFO_BASENAME,
1077
     *                        PATHINFO_EXTENSION or
1078
     *                        PATHINFO_FILENAME.
1079
     *
1080
     * @return mixed
1081
     */
1082
    public function pathinfo(string $path, int $options = null)
0 ignored issues
show
The parameter $path is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1083
    {
1084
        return call_user_func_array('pathinfo', func_get_args());
1085
    }
1086
1087
    /**
1088
     * Closes process file pointer
1089
     *
1090
     * @param resource $handle The file pointer must be valid, and must have been returned by a
1091
     *                         successful call to popen.
1092
     *
1093
     * @return int
1094
     */
1095
    public function pclose($handle) : int
1096
    {
1097
        return pclose($handle);
1098
    }
1099
1100
    /**
1101
     * Opens process file pointer
1102
     *
1103
     * @param string $command The command
1104
     * @param string $mode    The mode
1105
     *
1106
     * @return resource
1107
     */
1108
    public function popen(string $command, string $mode)
1109
    {
1110
        return popen($command, $mode);
1111
    }
1112
1113
    /**
1114
     * Outputs a file
1115
     *
1116
     * @param string   $filename       The filename being read.
1117
     * @param bool     $useIncludePath You can use the optional second parameter and set it to , if
1118
     *                                 you want to search for the file in the include_path, too.
1119
     * @param resource $context        A context stream resource.
1120
     *
1121
     * @return int
1122
     */
1123
    public function readfile(string $filename, bool $useIncludePath = null, $context = null) : int
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $useIncludePath is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1124
    {
1125
        return call_user_func_array('readfile', func_get_args());
1126
    }
1127
1128
    /**
1129
     * Returns the target of a symbolic link
1130
     *
1131
     * @param string $path The symbolic link path.
1132
     *
1133
     * @return string
1134
     */
1135
    public function readlink(string $path) : string
1136
    {
1137
        return readlink($path);
1138
    }
1139
1140
    /**
1141
     * Get realpath cache entries
1142
     *
1143
     * @return array
1144
     */
1145
    public function realpathCacheGet() : array
1146
    {
1147
        return realpath_cache_get();
1148
    }
1149
1150
    /**
1151
     * Get realpath cache size
1152
     *
1153
     * @return int
1154
     */
1155
    public function realpathCacheSize() : int
1156
    {
1157
        return realpath_cache_size();
1158
    }
1159
1160
    /**
1161
     * Returns canonicalized absolute pathname
1162
     *
1163
     * @param string $path The path being checked.
1164
     *
1165
     *
1166
     * Whilst a path must be supplied, the value can be blank or
1167
     * In these cases, the value is interpreted as the current directory.
1168
     *
1169
     * @return string
1170
     */
1171
    public function realpath(string $path) : string
1172
    {
1173
        return realpath($path);
1174
    }
1175
1176
    /**
1177
     * Renames a file or directory
1178
     *
1179
     * @param string   $oldname
1180
     * @param string   $newname The new name.
1181
     * @param resource $context
1182
     *
1183
     * @return bool
1184
     */
1185
    public function rename(string $oldname, string $newname, $context = null) : bool
0 ignored issues
show
The parameter $oldname is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $newname is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1186
    {
1187
        return call_user_func_array('rename', func_get_args());
1188
    }
1189
1190
    /**
1191
     * Rewind the position of a file pointer
1192
     *
1193
     * @param resource $handle The file pointer must be valid, and must point to a file
1194
     *                         successfully opened by fopen.
1195
     *
1196
     * @return bool
1197
     */
1198
    public function rewind($handle) : bool
1199
    {
1200
        return rewind($handle);
1201
    }
1202
1203
    /**
1204
     * Removes directory
1205
     *
1206
     * @param string   $dirname Path to the directory.
1207
     * @param resource $context
1208
     *
1209
     * @return bool
1210
     */
1211
    public function rmdir(string $dirname, $context = null) : bool
0 ignored issues
show
The parameter $dirname is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1212
    {
1213
        return call_user_func_array('rmdir', func_get_args());
1214
    }
1215
1216
    /**
1217
     * Gives information about a file
1218
     *
1219
     * @param string $filename Path to the file.
1220
     *
1221
     * @return array
1222
     */
1223
    public function stat(string $filename) : array
1224
    {
1225
        return stat($filename);
1226
    }
1227
1228
    /**
1229
     * Creates a symbolic link
1230
     *
1231
     * @param string $target Target of the link.
1232
     * @param string $link   The link name.
1233
     *
1234
     * @return bool
1235
     */
1236
    public function symlink(string $target, string $link) : bool
1237
    {
1238
        return symlink($target, $link);
1239
    }
1240
1241
    /**
1242
     * Create file with unique file name
1243
     *
1244
     * @param string $dir    The directory where the temporary filename will be created.
1245
     * @param string $prefix The prefix of the generated temporary filename.
1246
     *
1247
     * @return string
1248
     */
1249
    public function tempnam(string $dir, string $prefix) : string
1250
    {
1251
        return tempnam($dir, $prefix);
1252
    }
1253
1254
    /**
1255
     * Creates a temporary file
1256
     *
1257
     * @return resource
1258
     */
1259
    public function tmpfile()
1260
    {
1261
        return tmpfile();
1262
    }
1263
1264
    /**
1265
     * Sets access and modification time of file
1266
     *
1267
     * @param string $filename The name of the file being touched.
1268
     * @param int    $time     The touch time. If time is not supplied,
1269
     *                         the current system time is used.
1270
     * @param int    $atime    If present, the access time of the given filename is set to
1271
     *                         the value of atime. Otherwise, it is set to
1272
     *                         the value passed to the time parameter.
1273
     *                         If neither are present, the current system time is used.
1274
     *
1275
     * @return bool
1276
     */
1277
    public function touch(string $filename, int $time = null, int $atime = null) : bool
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $time is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $atime is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1278
    {
1279
        return call_user_func_array('touch', func_get_args());
1280
    }
1281
1282
    /**
1283
     * Changes the current umask
1284
     *
1285
     * @param int $mask The new umask.
1286
     *
1287
     * @return int
1288
     */
1289
    public function umask(int $mask = null) : int
0 ignored issues
show
The parameter $mask is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1290
    {
1291
        return call_user_func_array('umask', func_get_args());
1292
    }
1293
1294
    /**
1295
     * Deletes a file
1296
     *
1297
     * @param string   $filename Path to the file.
1298
     * @param resource $context
1299
     *
1300
     * @return bool
1301
     */
1302
    public function unlink(string $filename, $context = null) : bool
0 ignored issues
show
The parameter $filename is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
1303
    {
1304
        return call_user_func_array('unlink', func_get_args());
1305
    }
1306
1307
}
1308
1309