1 | <?php |
||
34 | trait FilesystemTrait |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * The filesystem adapter instance. |
||
39 | * |
||
40 | * @return \TechDivision\Import\Adapter\FilesystemAdapterInterface |
||
41 | */ |
||
42 | protected $filesystemAdapater; |
||
43 | |||
44 | /** |
||
45 | * Set's the virtual filesystem instance. |
||
46 | * |
||
47 | * @param \TechDivision\Import\Adapter\FilesystemAdapterInterface $filesystemAdapter The filesystem adapter instance |
||
48 | * |
||
49 | * @return void |
||
50 | */ |
||
51 | 13 | public function setFilesystemAdapter(FilesystemAdapterInterface $filesystemAdapter) |
|
55 | |||
56 | /** |
||
57 | * Return's the filesystem adapater instance. |
||
58 | * |
||
59 | * @return \TechDivision\Import\Adapter\FilesystemAdapterInterface The filesystem adapter instance |
||
60 | */ |
||
61 | 13 | public function getFilesystemAdapter() |
|
65 | |||
66 | /** |
||
67 | * This method tries to resolve the passed path and returns it. If the path |
||
68 | * is relative, the actual working directory will be prepended. |
||
69 | * |
||
70 | * @param string $path The path to be resolved |
||
71 | * |
||
72 | * @return string The resolved path |
||
73 | * @throws \InvalidArgumentException Is thrown, if the path can not be resolved |
||
74 | */ |
||
75 | 3 | public function resolvePath($path) |
|
93 | 1 | ||
94 | /** |
||
95 | * Return's the resolved directory of the passed path. |
||
96 | * |
||
97 | * @param string $path The path to resolve |
||
98 | * |
||
99 | * @return string The resolved path |
||
100 | */ |
||
101 | private function realpath(string $path = null) : string |
||
117 | |||
118 | /** |
||
119 | * Creates a new directroy. |
||
120 | 4 | * |
|
121 | * @param string $pathname The directory path |
||
122 | 4 | * @param integer $mode The mode is 0777 by default, which means the widest possible access |
|
123 | * @param string $recursive Allows the creation of nested directories specified in the pathname |
||
124 | * |
||
125 | * @return boolean TRUE on success, else FALSE |
||
126 | * @link http://php.net/mkdir |
||
127 | */ |
||
128 | public function mkdir($pathname, $mode = 0700, $recursive = false) |
||
132 | |||
133 | 2 | /** |
|
134 | * Query whether or not the passed filename exists. |
||
135 | 2 | * |
|
136 | * @param string $filename The filename to query |
||
137 | * |
||
138 | * @return boolean TRUE if the passed filename exists, else FALSE |
||
139 | * @link http://php.net/is_file |
||
140 | */ |
||
141 | public function isFile($filename) |
||
145 | 1 | ||
146 | /** |
||
147 | 1 | * Tells whether the filename is a directory. |
|
148 | * |
||
149 | * @param string $filename Path to the file |
||
150 | * |
||
151 | * @return TRUE if the filename exists and is a directory, else FALSE |
||
152 | * @link http://php.net/is_dir |
||
153 | */ |
||
154 | public function isDir($filename) |
||
158 | |||
159 | 1 | /** |
|
160 | * Creates an empty file with the passed filename. |
||
161 | 1 | * |
|
162 | * @param string $filename The name of the file to create |
||
163 | * |
||
164 | * @return boolean TRUE if the file can be created, else FALSE |
||
165 | */ |
||
166 | public function touch($filename) |
||
170 | |||
171 | /** |
||
172 | * Renames a file or directory. |
||
173 | 1 | * |
|
174 | * @param string $oldname The old name |
||
175 | 1 | * @param string $newname The new name |
|
176 | * |
||
177 | * @return boolean TRUE on success, else FALSE |
||
178 | * @link http://php.net/rename |
||
179 | */ |
||
180 | public function rename($oldname, $newname) |
||
184 | |||
185 | /** |
||
186 | * Writes the passed data to file with the passed name. |
||
187 | * |
||
188 | * @param string $filename The name of the file to write the data to |
||
189 | * @param string $data The data to write to the file |
||
190 | * |
||
191 | * @return number The number of bytes written to the file |
||
192 | * @link http://php.net/file_put_contents |
||
193 | */ |
||
194 | public function write($filename, $data) |
||
198 | } |
||
199 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.