Passed
Push — master ( 868a85...47fe80 )
by Morten Poul
03:20
created

ActivateLanguage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
1
<?php
2
3
namespace Signifly\Translator\Http\Middleware;
4
5
use Closure;
6
use Signifly\Translator\Facades\Translator;
7
8
class ActivateLanguage
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param  \Illuminate\Http\Request  $request
14
     * @param  \Closure  $next
15
     * @return mixed
16
     */
17
    public function handle($request, Closure $next)
18
    {
19
        $param = Translator::languageParameter();
20
        $defaultLang = Translator::defaultLanguageCode();
21
22
        Translator::activateLanguage($request->input($param, $defaultLang));
23
24
        return $next($request);
25
    }
26
}
27