Passed
Push — main ( 8320d0...c2748c )
by Andrey
45:28 queued 42:35
created

Install::run()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 7
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 15
ccs 8
cts 8
cp 1
crap 4
rs 10
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
{
10 12
    public function run(): string
11
    {
12 12
        $this->log('Start the handler for execution:', self::class);
13
14 12
        if ($this->sourceDoesntExists()) {
15 12
            return Status::NOT_FOUND;
16
        }
17
18 12
        if ($this->force || $this->doesntExists()) {
19 12
            $this->main();
20
21 12
            return Status::COPIED;
22
        }
23
24 1
        return Status::SKIPPED;
25
    }
26
27 12
    protected function sourceDoesntExists(): bool
28
    {
29 12
        $this->log('Checking for the existence of a file:', $this->source_path);
30
31 12
        return ! File::exists($this->source_path);
32
    }
33
}
34