Passed
Push — master ( d8cc68...c5f99b )
by Andrey
21:06 queued 05:59
created

Localization::full()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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