| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function removeDirRecursive(string $dirPath): void |
||
| 14 | { |
||
| 15 | /** @var SplFileInfo[] $files */ |
||
| 16 | $files = new RecursiveIteratorIterator( |
||
| 17 | new RecursiveDirectoryIterator($dirPath, FilesystemIterator::SKIP_DOTS), |
||
| 18 | RecursiveIteratorIterator::CHILD_FIRST |
||
| 19 | ); |
||
| 20 | foreach ($files as $file) { |
||
| 21 | if ($file->isDir()) { |
||
| 22 | $this->removeDirRecursive($file->getRealPath()); |
||
| 23 | } else { |
||
| 24 | unlink($file->getRealPath()); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | rmdir($dirPath); |
||
| 28 | } |
||
| 30 | } |