| Conditions | 5 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public static function initTempDir(string $path) |
||
| 12 | { |
||
| 13 | if (!@mkdir($path, 0777, true) && !is_dir($path)) { |
||
| 14 | throw new \RuntimeException(sprintf('Cannot create temp directory %s', $path)); |
||
| 15 | } |
||
| 16 | |||
| 17 | /** @var \SplFileInfo $entry */ |
||
| 18 | foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $entry) { |
||
| 19 | $entry->isDir() ? rmdir((string) $entry) : unlink((string) $entry); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | } |
||
| 23 |