Passed
Push — master ( 07eb6c...4d370f )
by Reza
03:56
created

LangManager::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
namespace EasyPanel\Services;
4
5
use Illuminate\Support\Facades\File;
6
use Illuminate\Support\Str;
7
8
class LangManager
9
{
10
    public static function get()
11
    {
12
        $files = collect(File::glob(resource_path('lang/*_panel.json')));
13
14
        return $files->mapWithKeys(function ($file, $key){
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

14
        return $files->mapWithKeys(function ($file, /** @scrutinizer ignore-unused */ $key){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
15
            preg_match('/(\w+)_panel\.json/i', $file, $m);
16
            $key = "$m[1]_panel";
17
            $value = Str::upper($m[1]);
18
            return [$key => $value];
19
        })->toArray();
20
    }
21
}
22