Passed
Push — master ( c97482...68f9e3 )
by Andrey
07:00 queued 04:30
created

DeletePhp::isProtected()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processing;
4
5
use Helldar\LaravelLangPublisher\Constants\Status;
6
use Helldar\LaravelLangPublisher\Facades\Locale;
7
use Helldar\LaravelLangPublisher\Facades\Path;
8
use Illuminate\Support\Facades\File as IlluminateFile;
9
10
final class DeletePhp extends BaseProcess
11
{
12 12
    public function run(): array
13
    {
14 12
        $this->checkExists($this->path());
15
16 12
        $this->delete()
17 6
            ? $this->push('*', Status::DELETED)
18 6
            : $this->push('*', Status::SKIPPED);
19
20 12
        return $this->result();
21
    }
22
23 12
    protected function delete(): bool
24
    {
25 12
        return ! $this->isProtected()
26 6
            ? IlluminateFile::deleteDirectory($this->path())
27 12
            : false;
28
    }
29
30 12
    protected function path(): string
31
    {
32 12
        return Path::target($this->locale);
33
    }
34
35 12
    protected function isProtected(): bool
36
    {
37 12
        return Locale::isProtected($this->locale);
38
    }
39
}
40