Passed
Pull Request — master (#1300)
by Curtis
05:45
created

Store   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 2
1
<?php
2
3
namespace App\Http\Controllers\enso\core\Preferences;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Routing\Controller;
7
use Illuminate\Support\Facades\Auth;
8
9
class Store extends Controller
10
{
11
    public function __invoke(Request $request)
12
    {
13
        if ($request->has('global')) {
14
            Auth::user()->storeGlobalPreferences($request->get('global'));
0 ignored issues
show
Bug introduced by
The method storeGlobalPreferences() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

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

14
            Auth::user()->/** @scrutinizer ignore-call */ storeGlobalPreferences($request->get('global'));
Loading history...
15
16
            return;
17
        }
18
19
        Auth::user()->storeLocalPreferences(
0 ignored issues
show
Bug introduced by
The method storeLocalPreferences() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

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

19
        Auth::user()->/** @scrutinizer ignore-call */ storeLocalPreferences(
Loading history...
20
            $request->get('route'), $request->get('value')
21
        );
22
    }
23
}
24