Conditions | 4 |
Paths | 6 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
77 | 4 | protected function _remove(string $directory = null) : void |
|
78 | { |
||
79 | 4 | $iterator = $this->_scan($directory); |
|
80 | |||
81 | /* handle recursive */ |
||
82 | |||
83 | 4 | if ($this->_recursive) |
|
84 | { |
||
85 | 3 | $iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST); |
|
86 | } |
||
87 | |||
88 | /* process iterator */ |
||
89 | |||
90 | 4 | foreach ($iterator as $item) |
|
91 | { |
||
92 | 4 | $path = $item->getPathName(); |
|
93 | 4 | $item->isDir() ? rmdir($path) : unlink($path); |
|
94 | } |
||
95 | 4 | } |
|
96 | } |
||
97 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: