Passed
Push — master ( 68f9e3...36b0af )
by Andrey
02:57 queued 39s
created

Localization::makeProcess()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 10
cc 2
nc 2
nop 1
crap 2.0625
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
    public function setPath(Pathable $path): Localizationable
24
    {
25 78
        $this->path = $path;
26
27 78
        return $this;
28
    }
29
30 78
    public function setProcessor(Processor $processor): Localizationable
31
    {
32 78
        $this->processor = $processor;
33
34 78
        return $this;
35
    }
36
37 78
    public function run(string $locale, bool $force = false): array
38
    {
39 78
        return $this->processor
40 78
            ->locale($locale)
41 78
            ->force($force)
42 78
            ->run();
43
    }
44
}
45