Conditions | 4 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
34 | public function delete(?string $path = null): bool |
||
35 | { |
||
36 | $dir = dirname(__DIR__, 4) . "/"; |
||
37 | if($path){ |
||
38 | if(!unlink($dir . $path)) |
||
39 | { |
||
40 | $this->setResponse(404,"error","$path file not exist","upload",dynamic: $path); |
||
41 | return false; |
||
42 | } |
||
43 | } |
||
44 | foreach ($this->response()->data as $value) { |
||
45 | unlink($dir . $value); |
||
46 | } |
||
47 | $this->setResponse(200,"success","file deleted successfully","upload"); |
||
48 | return true; |
||
49 | } |
||
58 | } |