artem-prozorov /
filemanager
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | |||||
| 5 | namespace Prozorov\Filemanager; |
||||
| 6 | |||||
| 7 | class Manager |
||||
| 8 | { |
||||
| 9 | /** |
||||
| 10 | * file_get_contents wrapper |
||||
| 11 | * |
||||
| 12 | * @access public |
||||
| 13 | * @param string $filename |
||||
| 14 | * @return mixed |
||||
| 15 | */ |
||||
| 16 | public function getContents(string $filename) |
||||
| 17 | { |
||||
| 18 | return file_get_contents($filename); |
||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * file_put_contents wrapper |
||||
| 23 | * |
||||
| 24 | * @access public |
||||
| 25 | * @param string $filename |
||||
| 26 | * @param mixed $data |
||||
| 27 | * @return mixed |
||||
| 28 | */ |
||||
| 29 | public function putContents(string $filename, $data) |
||||
| 30 | { |
||||
| 31 | return file_put_contents($filename, $data); |
||||
| 32 | } |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * file_exists wrapper |
||||
| 36 | * |
||||
| 37 | * @access public |
||||
| 38 | * @param string $filename |
||||
| 39 | * @return bool |
||||
| 40 | */ |
||||
| 41 | public function exists(string $filename): bool |
||||
| 42 | { |
||||
| 43 | return file_exists($filename); |
||||
| 44 | } |
||||
| 45 | |||||
| 46 | /** |
||||
| 47 | * mkdir wrapper |
||||
| 48 | * |
||||
| 49 | * @access public |
||||
| 50 | * @param string $pathname |
||||
| 51 | * @param integer $mode Default: 0777 |
||||
| 52 | * @param boolean $recursive Default: false |
||||
| 53 | * @return bool |
||||
| 54 | */ |
||||
| 55 | public function mkdir(string $pathname, int $mode = 0777, bool $recursive = false): bool |
||||
| 56 | { |
||||
| 57 | return mkdir($pathname, $mode, $recursive); |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | /** |
||||
| 61 | * rename wrapper |
||||
| 62 | * |
||||
| 63 | * @access public |
||||
| 64 | * @param string $oldname |
||||
| 65 | * @param string $newname |
||||
| 66 | * @param resource $context |
||||
| 67 | * @return bool |
||||
| 68 | */ |
||||
| 69 | public function rename(string $oldname, string $newname, resource $context = null): bool |
||||
|
0 ignored issues
–
show
|
|||||
| 70 | { |
||||
| 71 | return rename($oldname, $newname, $context); |
||||
|
0 ignored issues
–
show
It seems like
$context can also be of type Prozorov\Filemanager\resource; however, parameter $context of rename() does only seem to accept resource, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 72 | } |
||||
| 73 | |||||
| 74 | /** |
||||
| 75 | * touch wrapper |
||||
| 76 | * |
||||
| 77 | * @access public |
||||
| 78 | * @param string $filename |
||||
| 79 | * @param int $time Default: null |
||||
| 80 | * @param int $atime Default: null |
||||
| 81 | * @return bool |
||||
| 82 | */ |
||||
| 83 | public function touch(string $filename, int $time = null, int $atime = null): bool |
||||
| 84 | { |
||||
| 85 | if (empty($time)) { |
||||
| 86 | $time = time(); |
||||
| 87 | } |
||||
| 88 | |||||
| 89 | if (empty($atime)) { |
||||
| 90 | $atime = time(); |
||||
| 91 | } |
||||
| 92 | |||||
| 93 | return touch($filename, $time, $atime); |
||||
| 94 | } |
||||
| 95 | |||||
| 96 | /** |
||||
| 97 | * sys_get_temp_dir wrapper |
||||
| 98 | * |
||||
| 99 | * @access public |
||||
| 100 | * @return string |
||||
| 101 | */ |
||||
| 102 | public function getTempDir(): string |
||||
| 103 | { |
||||
| 104 | return sys_get_temp_dir(); |
||||
| 105 | } |
||||
| 106 | |||||
| 107 | /** |
||||
| 108 | * Unlink wrapper |
||||
| 109 | * |
||||
| 110 | * @access public |
||||
| 111 | * @param string $filename |
||||
| 112 | * @param resource $context |
||||
| 113 | * @return bool |
||||
| 114 | */ |
||||
| 115 | public function unlink(string $filename, resource $context = null): bool |
||||
| 116 | { |
||||
| 117 | return unlink($filename, $context); |
||||
|
0 ignored issues
–
show
It seems like
$context can also be of type Prozorov\Filemanager\resource; however, parameter $context of unlink() does only seem to accept resource, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 118 | } |
||||
| 119 | |||||
| 120 | /** |
||||
| 121 | * is_dir wrapper |
||||
| 122 | * |
||||
| 123 | * @access public |
||||
| 124 | * @param string $path |
||||
| 125 | * @return bool |
||||
| 126 | */ |
||||
| 127 | public function isDir(string $path): bool |
||||
| 128 | { |
||||
| 129 | return is_dir($path); |
||||
| 130 | } |
||||
| 131 | } |
||||
| 132 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths