File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -251,21 +251,21 @@ public function deleteFile(string $name): bool {
251
251
* @param string|null $name
252
252
* @return bool
253
253
*/
254
- public function rmdir (string $ name = null ): bool {
255
- $ iterator = new RecursiveDirectoryIterator (
254
+ public function rmdir (): bool {
255
+ $ itemsDeleted = false ;
256
+ $ iterator = new RecursiveDirectoryIterator (
256
257
$ this ->getPath ()
257
258
);
258
259
259
260
/** @var SplFileInfo $item */
260
261
foreach ($ iterator as $ item ) {
261
- if (false === $ item ->isDir ()) continue ;
262
- if ($ item ->getBasename () === $ name ) {
263
- unlink ($ item ->getRealPath ());
264
- return true ;
265
- }
262
+ $ itemDeleted = unlink ($ item ->getRealPath ());
263
+ $ itemsDeleted = $ itemsDeleted && $ itemDeleted ;
266
264
}
267
265
268
- return false ;
266
+ $ pathDeleted = unlink ($ this ->getPath ());
267
+
268
+ return true === $ itemsDeleted && true === $ pathDeleted ;
269
269
}
270
270
271
271
}
You can’t perform that action at this time.
0 commit comments