Passed
Pull Request — master (#65)
by Andrey
17:57 queued 02:52
created

Localization::full()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services;
4
5
use Helldar\LaravelLangPublisher\Contracts\Localizationable;
6
use Helldar\LaravelLangPublisher\Contracts\Pathable;
7
use Helldar\LaravelLangPublisher\Contracts\Processor;
8
use Helldar\LaravelLangPublisher\Traits\Containable;
9
10
final class Localization implements Localizationable
11
{
12
    use Containable;
13
14
    /** @var \Helldar\LaravelLangPublisher\Contracts\Pathable */
15
    protected $path;
16
17
    /** @var \Helldar\LaravelLangPublisher\Contracts\Processor */
18
    protected $processor;
19
20
    /** @var array */
21
    protected $result = [];
22
23 78
    /** @var bool */
24
    protected $is_force = false;
25 78
26
    /** @var bool */
27 78
    protected $is_full = false;
28
29
    public function setPath(Pathable $path): Localizationable
30 78
    {
31
        $this->path = $path;
32 78
33
        return $this;
34 78
    }
35
36
    public function setProcessor(Processor $processor): Localizationable
37 78
    {
38
        $this->processor = $processor;
39 78
40 78
        return $this;
41 78
    }
42 78
43
    public function force(bool $is_force = true): Localizationable
44
    {
45
        $this->is_force = $is_force;
46
47
        return $this;
48
    }
49
50
    public function full(bool $is_full = true): Localizationable
51
    {
52
        $this->is_full = $is_full;
53
54
        return $this;
55
    }
56
57
    public function run(string $locale): array
58
    {
59
        return $this->processor
60
            ->locale($locale)
61
            ->force($this->is_force)
62
            ->full($this->is_full)
63
            ->run();
64
    }
65
}
66