Conditions | 4 |
Paths | 4 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
16 | 11 | public function __invoke(string $path) |
|
17 | { |
||
18 | 11 | if (file_exists($path . '/.do_not_clear')) { |
|
19 | 11 | return; |
|
20 | } |
||
21 | 11 | foreach (\glob(\rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*') as $file) { |
|
22 | 11 | \is_dir($file) ? $this->__invoke($file) : \unlink($file); |
|
23 | 11 | @\rmdir($file); |
|
|
|||
24 | } |
||
25 | 11 | } |
|
26 | |||
38 |
If you suppress an error, we recommend checking for the error condition explicitly: