LangChanger   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 2
1
<?php
2
3
namespace EasyPanel\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Support\Facades\App;
7
use Illuminate\Support\Facades\Session;
8
9
class LangChanger
10
{
11
12
    public function handle($request, Closure $next)
13
    {
14
        $lang = session()->has('easypanel_lang')
15
            ? session()->get('easypanel_lang')
16
            : (config('easy_panel.lang') ?? 'en') .'_panel';
17
18
        App::setLocale($lang);
19
20
        return $next($request);
21
    }
22
23
}
24