Passed
Push — master ( a7279d...feb425 )
by Andrey
11:45
created

BaseProcess   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 11
c 1
b 0
f 0
dl 0
loc 39
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A checkExists() 0 3 1
A locale() 0 5 1
A result() 0 3 1
A force() 0 5 1
A push() 0 5 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processing;
4
5
use Helldar\LaravelLangPublisher\Contracts\Process;
6
use Helldar\LaravelLangPublisher\Facades\File;
7
8
use function compact;
9
10
abstract class BaseProcess implements Process
11
{
12
    /** @var string */
13
    protected $locale;
14
15
    /** @var bool */
16
    protected $force;
17
18
    protected $result = [];
19
20
    public function locale(string $locale): self
21
    {
22
        $this->locale = $locale;
23
24
        return $this;
25
    }
26
27
    public function force(bool $force = false): self
28
    {
29
        $this->force = $force;
30
31
        return $this;
32
    }
33
34
    public function result(): array
35
    {
36
        return $this->result;
37
    }
38
39
    protected function push(string $filename, string $status): void
40
    {
41
        $locale = $this->locale;
42
43
        $this->result[] = compact('locale', 'filename', 'status');
44
    }
45
46
    protected function checkExists(string $path): void
47
    {
48
        File::directoryExists($path, $this->locale);
49
    }
50
}
51