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