Passed
Push — 9.x ( f1c174...3a6a77 )
by Andrey
14:09
created

Manage::full()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Comparators;
4
5
use Helldar\LaravelLangPublisher\Concerns\Contains;
6
use Helldar\LaravelLangPublisher\Concerns\Keyable;
7
use Helldar\LaravelLangPublisher\Concerns\Logger;
8
use Helldar\LaravelLangPublisher\Contracts\Comparator as ComparatorContract;
9
use Helldar\LaravelLangPublisher\Facades\Path;
10
use Helldar\Support\Concerns\Makeable;
11
12
final class Manage
13
{
14
    use Contains;
15
    use Keyable;
16
    use Logger;
17
    use Makeable;
18
19
    protected $source;
20
21
    protected $target;
22
23
    protected $filename;
24
25
    protected $full = false;
26
27
    protected $key;
28
29
    public function source(array $array): self
30
    {
31
        $this->source = $array;
32
33
        return $this;
34
    }
35
36
    public function target(array $array): self
37
    {
38
        $this->target = $array;
39
40
        return $this;
41
    }
42
43
    public function filename(string $filename): self
44
    {
45
        $this->filename = Path::filename($filename);
46
        $this->key      = $this->key($filename);
47
48
        return $this;
49
    }
50
51
    public function full(bool $full): self
52
    {
53
        $this->full = $full;
54
55
        return $this;
56
    }
57
58
    public function find(): ComparatorContract
59
    {
60
        $this->log('Comparison object definition...');
61
62
        return $this->resolve()
63
            ->full($this->full)
64
            ->key($this->key)
65
            ->source($this->source)
66
            ->target($this->target);
67
    }
68
69
    protected function resolve(): ComparatorContract
70
    {
71
        $this->log('Comparison object resolve...');
72
73
        return $this->isValidation($this->filename) ? Validation::make() : Basic::make();
74
    }
75
}
76