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

LangManager   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 10 1
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