| Conditions | 6 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function rmdir(string $dir): void |
||
| 27 | { |
||
| 28 | if (is_dir($dir)) { |
||
| 29 | $objects = scandir($dir); |
||
| 30 | foreach ($objects as $object) { |
||
| 31 | if ($object !== "." && $object !== "..") { |
||
| 32 | if (is_dir($dir. '/' .$object)) { |
||
| 33 | self::rmdir($dir. '/' .$object); |
||
| 34 | } else { |
||
| 35 | unlink($dir. '/' .$object); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 | rmdir($dir); |
||
| 40 | } |
||
| 43 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.