Total Complexity | 7 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class DeleteJson extends BaseProcess |
||
12 | { |
||
13 | protected $extension = '.json'; |
||
14 | |||
15 | public function run(): array |
||
16 | { |
||
17 | $this->checkExists($this->path()); |
||
18 | |||
19 | $this->delete() |
||
20 | ? $this->push($this->locale, Status::DELETED) |
||
21 | : $this->push($this->locale, Status::SKIPPED); |
||
22 | |||
23 | return $this->result(); |
||
24 | } |
||
25 | |||
26 | protected function delete(): bool |
||
27 | { |
||
28 | return ! $this->isProtected() |
||
29 | ? IlluminateFile::delete($this->path()) |
||
30 | : false; |
||
31 | } |
||
32 | |||
33 | protected function path(): string |
||
34 | { |
||
35 | return Path::target($this->locale . $this->extension); |
||
36 | } |
||
37 | |||
38 | protected function isProtected(): bool |
||
41 | } |
||
42 | |||
43 | protected function checkExists(string $path): void |
||
46 | } |
||
47 | } |
||
48 |