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

PublishJson::publish()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processors;
4
5
use Helldar\LaravelLangPublisher\Facades\Config;
6
use Helldar\LaravelLangPublisher\Traits\Processors\Publishable;
7
use SplFileInfo;
8
9
final class PublishJson extends BaseProcessor
10
{
11
    use Publishable;
12
13
    protected $extension = 'json';
14
15 18
    protected function publish(): void
16
    {
17 18
        $this->publishFile(
18 18
            new SplFileInfo($this->sourcePath())
19
        );
20 18
    }
21
22 18
    protected function excluded(array $array, string $key): array
23
    {
24 18
        $keys = Config::getExclude($key, [], true);
25
26
        return array_filter($array, static function ($value) use ($keys) {
27 12
            return in_array($value, $keys);
28 18
        }, ARRAY_FILTER_USE_KEY);
29
    }
30
}
31