Passed
Push — feature/screening-plan-l10n ( 75403d...7eec86 )
by Tristan
06:23 queued 55s
created

ManagerPolicy   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
eloc 4
dl 0
loc 74
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A restore() 0 2 1
A update() 0 5 2
A forceDelete() 0 2 1
A delete() 0 2 1
A view() 0 4 1
A create() 0 2 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Models\Manager;
7
use App\Policies\BasePolicy;
8
9
class ManagerPolicy extends BasePolicy
10
{
11
12
    /**
13
     * Determine whether the user can view the manager.
14
     *
15
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
16
     * @param  \App\Models\Manager  $manager
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...
17
     * @return mixed
18
     */
19
    public function view(User $user, Manager $manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager 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

19
    public function view(User $user, /** @scrutinizer ignore-unused */ Manager $manager)

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...
20
    {
21
        //Manager profiles are viewable by any logged-in user
22
        return $user != null;
23
    }
24
25
    /**
26
     * Determine whether the user can create managers.
27
     *
28
     * @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...
29
     * @return mixed
30
     */
31
    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

31
    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...
32
    {
33
        //
34
    }
35
36
    /**
37
     * Determine whether the user can update the manager.
38
     *
39
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
40
     * @param  \App\Models\Manager  $manager
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...
41
     * @return mixed
42
     */
43
    public function update(User $user, Manager $manager)
44
    {
45
        //Mangers can only update their own profiles
46
        return $user->user_role->name == 'manager' &&
47
            $manager->user_id == $user->id;
48
    }
49
50
    /**
51
     * Determine whether the user can delete the manager.
52
     *
53
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
54
     * @param  \App\Models\Manager  $manager
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...
55
     * @return mixed
56
     */
57
    public function delete(User $user, Manager $manager)
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

57
    public function delete(/** @scrutinizer ignore-unused */ User $user, Manager $manager)

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 $manager 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

57
    public function delete(User $user, /** @scrutinizer ignore-unused */ Manager $manager)

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...
58
    {
59
        //
60
    }
61
62
    /**
63
     * Determine whether the user can restore the manager.
64
     *
65
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
66
     * @param  \App\Models\Manager  $manager
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...
67
     * @return mixed
68
     */
69
    public function restore(User $user, Manager $manager)
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

69
    public function restore(/** @scrutinizer ignore-unused */ User $user, Manager $manager)

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 $manager 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

69
    public function restore(User $user, /** @scrutinizer ignore-unused */ Manager $manager)

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...
70
    {
71
        //
72
    }
73
74
    /**
75
     * Determine whether the user can permanently delete the manager.
76
     *
77
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 2 found
Loading history...
78
     * @param  \App\Models\Manager  $manager
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...
79
     * @return mixed
80
     */
81
    public function forceDelete(User $user, Manager $manager)
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

81
    public function forceDelete(/** @scrutinizer ignore-unused */ User $user, Manager $manager)

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 $manager 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

81
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ Manager $manager)

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...
82
    {
83
        //
84
    }
85
}
86