Total Complexity | 10 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class Uninstall extends Processor |
||
12 | { |
||
13 | public function run(): string |
||
14 | { |
||
15 | if ($this->exists() && $this->doesntProtect()) { |
||
16 | $this->delete(); |
||
17 | $this->deleteDirectory(); |
||
18 | |||
19 | return $this->deleted(); |
||
20 | } |
||
21 | |||
22 | return $this->skipped(); |
||
23 | } |
||
24 | |||
25 | protected function delete(): void |
||
26 | { |
||
27 | $this->log('Deleting a file: ' . $this->target_path); |
||
28 | |||
29 | if (File::exists($this->target_path)) { |
||
30 | File::delete($this->target_path); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | protected function deleteDirectory(): void |
||
42 | } |
||
43 | } |
||
44 | |||
45 | protected function deleted(): string |
||
48 | } |
||
49 | |||
50 | protected function skipped(): string |
||
55 | } |
||
56 | |||
57 | protected function doesntProtect(): bool |
||
60 | } |
||
61 | } |
||
62 |