Passed
Pull Request — main (#107)
by Andrey
56:22 queued 41:16
created

Install::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processors;
4
5
use Helldar\LaravelLangPublisher\Constants\Status;
6
use Helldar\Support\Facades\Helpers\Filesystem\File;
7
8
final class Install extends Processor
9 12
{
10
    public function run(): string
11 12
    {
12
        $this->log('Start the handler for execution:', self::class);
13 12
14 12
        if ($this->sourceDoesntExists()) {
15
            return Status::NOT_FOUND;
16 12
        }
17
18
        if ($this->force || $this->doesntExists()) {
19 1
            $this->main();
20
21
            return Status::COPIED;
22 12
        }
23
24 12
        return Status::SKIPPED;
25 12
    }
26
27 12
    protected function sourceDoesntExists(): bool
28
    {
29 12
        $this->log('Checking for the existence of a file:', $this->source_path);
30 12
31
        return ! File::exists($this->source_path);
32
    }
33
}
34