ActivityPolicy   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A list() 0 12 3
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use Illuminate\Auth\Access\HandlesAuthorization;
7
8
class ActivityPolicy
9
{
10
    use HandlesAuthorization;
11
12
    public function list(User $user)
13
    {
14
        if ($user->can('read all recruitments')) {
15
            return true;
16
        }
17
18
        $candidate = Candidate::findOrFail(request()->get('candidate_id'));
0 ignored issues
show
Bug introduced by
The method get() does not exist on Illuminate\Http\Request. ( Ignorable by Annotation )

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

18
        $candidate = Candidate::findOrFail(request()->/** @scrutinizer ignore-call */ get('candidate_id'));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
        if ($user->can('view', $candidate)) {
20
            return true;
21
        }
22
23
        return false;
24
    }
25
}
26