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

ResetJson   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A excluded() 0 8 1
A publish() 0 4 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processors;
4
5
use Helldar\LaravelLangPublisher\Facades\Config;
6
use Helldar\LaravelLangPublisher\Facades\File;
7
use Helldar\LaravelLangPublisher\Traits\Processors\Publishable;
8
use SplFileInfo;
9
10
final class ResetJson extends BaseProcessor
11
{
12
    use Publishable;
13
14
    protected $extension = 'json';
15
16
    protected function publish(): void
17
    {
18
        $this->resetFile(
19
            new SplFileInfo($this->sourcePath())
20
        );
21
    }
22
23
    protected function excluded(array $array, string $filename): array
24
    {
25
        $key  = File::name($filename);
26
        $keys = Config::getExclude($key, [], true);
27
28
        return array_filter($array, static function ($value) use ($keys) {
29
            return in_array($value, $keys);
30
        }, ARRAY_FILTER_USE_KEY);
31
    }
32
}
33