Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 0 |
1 | <?php |
||
29 | 30 | public function passes($attribute, $value): bool |
|
30 | { |
||
31 | 30 | $this->attribute = $attribute; |
|
32 | |||
33 | 30 | if (! $user = Auth::user()) { |
|
34 | 24 | return false; |
|
35 | } |
||
36 | |||
37 | 6 | if (! $model = $this->className::find($value)) { |
|
|
|||
38 | return false; |
||
39 | } |
||
40 | |||
41 | 6 | return $user->can($this->ability, $model); |
|
42 | } |
||
43 | |||
55 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.