Passed
Pull Request — main (#84)
by Andrey
59:33 queued 44:34
created

Manage   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A source() 0 5 1
A resolve() 0 5 2
A filename() 0 5 1
A target() 0 5 1
A find() 0 7 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Comparators;
4
5
use Helldar\LaravelLangPublisher\Concerns\Contains;
6
use Helldar\LaravelLangPublisher\Concerns\Logger;
7
use Helldar\LaravelLangPublisher\Contracts\Comparator as ComparatorContract;
8
use Helldar\LaravelLangPublisher\Facades\Path;
9
use Helldar\Support\Concerns\Makeable;
10
11
final class Manage
12
{
13
    use Contains;
14
    use Logger;
15
    use Makeable;
16
17
    protected $source;
18
19
    protected $target;
20
21
    protected $filename;
22
23
    public function source(array $array): self
24
    {
25
        $this->source = $array;
26
27
        return $this;
28
    }
29
30
    public function target(array $array): self
31
    {
32
        $this->target = $array;
33
34
        return $this;
35
    }
36
37
    public function filename(string $filename): self
38
    {
39
        $this->filename = Path::filename($filename);
40
41
        return $this;
42
    }
43
44
    public function find(): ComparatorContract
45
    {
46
        $this->log('Comparison object definition...');
47
48
        return $this->resolve()
49
            ->source($this->source)
50
            ->target($this->target);
51
    }
52
53
    protected function resolve(): ComparatorContract
54
    {
55
        $this->log('Comparison object resolve...');
56
57
        return $this->isValidation($this->filename) ? Validation::make() : Basic::make();
58
    }
59
}
60