Passed
Push — feature/settings-2fa ( 2ec45d...d5e36c )
by Tristan
10:06
created

UserPolicy::view()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Policies\BasePolicy;
7
8
class UserPolicy extends BasePolicy
9
{
10
11
    /**
12
     * Determine whether the user can view the target user.
13
     *
14
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
15
     * @param  \App\Models\User  $targetUser
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
16
     * @return mixed
17
     */
18
    public function view(User $user, User $targetUser)
19
    {
20
        return $user->id === $targetUser->id;
21
    }
22
23
    /**
24
     * Determine whether the user can create courses.
25
     *
26
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
27
     * @return mixed
28
     */
29
    public function create(User $user)
0 ignored issues
show
Unused Code introduced by
The parameter $user 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

29
    public function create(/** @scrutinizer ignore-unused */ User $user)

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...
30
    {
31
        return false;
32
    }
33
34
    /**
35
     * Determine whether the user can update the target user.
36
     *
37
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
38
     * @param  \App\Models\User  $targetUser
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
39
     * @return mixed
40
     */
41
    public function update(User $user, User $targetUser)
42
    {
43
        return $user->id === $targetUser->id;
44
    }
45
46
    /**
47
     * Determine whether the user can delete the target user.
48
     *
49
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
50
     * @param  \App\Models\User  $targetUser
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
51
     * @return mixed
52
     */
53
    public function delete(User $user, User $targetUser)
0 ignored issues
show
Unused Code introduced by
The parameter $targetUser 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

53
    public function delete(User $user, /** @scrutinizer ignore-unused */ User $targetUser)

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...
Unused Code introduced by
The parameter $user 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

53
    public function delete(/** @scrutinizer ignore-unused */ User $user, User $targetUser)

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...
54
    {
55
        return false;
56
    }
57
}
58