LanguageController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 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
}