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

Delete::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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