Passed
Push — main ( 55f929...127e84 )
by Andrey
161:41 queued 158:10
created

Manage::filename()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
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;
0 ignored issues
show
Bug introduced by
The trait Helldar\LaravelLangPublisher\Concerns\Logger requires the property $output which is not provided by Helldar\LaravelLangPubli...ices\Comparators\Manage.
Loading history...
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 11
    public function source(array $array): self
30
    {
31 11
        $this->source = $array;
32
33 11
        return $this;
34
    }
35
36 11
    public function target(array $array): self
37
    {
38 11
        $this->target = $array;
39
40 11
        return $this;
41
    }
42
43 11
    public function filename(string $filename): self
44
    {
45 11
        $this->filename = Path::filename($filename);
46 11
        $this->key      = $this->key($filename);
47
48 11
        return $this;
49
    }
50
51 11
    public function full(bool $full): self
52
    {
53 11
        $this->full = $full;
54
55 11
        return $this;
56
    }
57
58 11
    public function find(): ComparatorContract
59
    {
60 11
        $this->log('Comparison object definition...');
61
62 11
        return $this->resolve()
63 11
            ->full($this->full)
64 11
            ->key($this->key)
65 11
            ->source($this->source)
66 11
            ->target($this->target);
67
    }
68
69 11
    protected function resolve(): ComparatorContract
70
    {
71 11
        $this->log('Comparison object resolve...');
72
73 11
        return $this->isValidation($this->filename) ? Validation::make() : Basic::make();
74
    }
75
}
76