LangChanger::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 2
b 0
f 0
nc 2
nop 2
dl 0
loc 9
rs 10
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