PublishJson   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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 PublishJson extends BaseProcessor
11
{
12
    use Publishable;
13
14
    protected $extension = 'json';
15 18
16
    protected function publish(): void
17 18
    {
18 18
        $this->publishFile(
19
            new SplFileInfo($this->sourcePath())
20 18
        );
21
    }
22 18
23
    protected function excluded(array $array, string $filename): array
24 18
    {
25
        $key  = File::name($filename);
26
        $keys = Config::getExclude($key, [], true);
27 12
28 18
        return array_filter($array, static function ($value) use ($keys) {
29
            return in_array($value, $keys);
30
        }, ARRAY_FILTER_USE_KEY);
31
    }
32
}
33