Passed
Pull Request — 9.x (#103)
by Andrey
57:24 queued 42:28
created

Install   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 24
rs 10
c 1
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sourceDoesntExists() 0 5 1
A run() 0 15 4
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
    public function run(): string
11
    {
12
        $this->log('Start the handler for execution:', self::class);
13
14
        if ($this->sourceDoesntExists()) {
15
            return Status::NOT_FOUND;
16
        }
17
18
        if ($this->force || $this->doesntExists()) {
19
            $this->main();
20
21
            return Status::COPIED;
22
        }
23
24
        return Status::SKIPPED;
25
    }
26
27
    protected function sourceDoesntExists(): bool
28
    {
29
        $this->log('Checking for the existence of a file:', $this->source_path);
30
31
        return ! File::exists($this->source_path);
32
    }
33
}
34