LanguageController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getChangeLang() 0 5 1
1
<?php namespace Distilleries\Expendable\Http\Controllers\Backend;
2
3
use Distilleries\Expendable\Contracts\LayoutManagerContract;
4
use Distilleries\Expendable\Http\Datatables\Language\LanguageDatatable;
5
use Distilleries\Expendable\Http\Forms\Language\LanguageForm;
6
use Distilleries\Expendable\Http\Controllers\Backend\Base\BaseComponent;
7
use Distilleries\Expendable\Models\Language;
8
9
class LanguageController extends BaseComponent {
10
11 42
    public function __construct(LanguageDatatable $datatable, LanguageForm $form, Language $model, LayoutManagerContract $layoutManager)
12
    {
13 42
        parent::__construct($model, $layoutManager);
14 42
        $this->datatable = $datatable;
15 42
        $this->form      = $form;
16
    }
17
18
19 2
    public function getChangeLang($locale = null)
20
    {
21 2
        session()->put('language', $locale);
22 2
        app()->setLocale($locale);
0 ignored issues
show
introduced by
The method setLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

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

22
        app()->/** @scrutinizer ignore-call */ setLocale($locale);
Loading history...
23 2
        return redirect()->back();
24
    }
25
}