Passed
Push — feature/admin-only-job-create ( 4243e9...e9cbd9 )
by Tristan
13:05 queued 07:52
created

BasePolicy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A before() 0 6 2
1
<?php
2
3
namespace App\Policies;
4
5
use Illuminate\Auth\Access\HandlesAuthorization;
6
use Illuminate\Support\Facades\Log;
7
8
class BasePolicy
9
{
10
    use HandlesAuthorization;
11
12 11
    public function before($user, $ability)
1 ignored issue
show
Unused Code introduced by
The parameter $ability is not used and could be removed. ( Ignorable by Annotation )

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

12
    public function before($user, /** @scrutinizer ignore-unused */ $ability)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
introduced by
Method \App\Policies\BasePolicy::before() does not have parameter type hint nor @param annotation for its parameter $user.
Loading history...
introduced by
Method \App\Policies\BasePolicy::before() does not have parameter type hint nor @param annotation for its parameter $ability.
Loading history...
introduced by
Method \App\Policies\BasePolicy::before() does not have return type hint nor @return annotation for its return value.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function before()
Loading history...
13
    {
14 11
        if ($user->user_role->name == 'admin') {
15 1
            $userText = '{id='.$user->id.'}';
16 1
            Log::notice('User '.$userText.' has bypassed policy as an Admin');
17 1
            return true;
18
        }
19 10
    }
20
}
21