Passed
Push — master ( a7279d...feb425 )
by Andrey
11:45
created

Delete   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 3 1
A path() 0 3 1
A run() 0 9 2
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processing;
4
5
use Helldar\LaravelLangPublisher\Constants\Status;
6
use Helldar\LaravelLangPublisher\Facades\Path;
7
use Illuminate\Support\Facades\File as IlluminateFile;
8
9
final class Delete extends BaseProcess
10
{
11
    public function run(): array
12
    {
13
        $this->checkExists($this->path());
14
15
        $this->delete()
16
            ? $this->push('*', Status::DELETED)
17
            : $this->push('*', Status::SKIPPED);
18
19
        return $this->result();
20
    }
21
22
    protected function delete(): bool
23
    {
24
        return IlluminateFile::deleteDirectory($this->path());
25
    }
26
27
    protected function path(): string
28
    {
29
        return Path::target($this->locale);
30
    }
31
}
32