Passed
Push — develop ( 6dcea6...5ae9a6 )
by Septianata
16:24
created

ConfigurationPolicy   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Test Coverage

Coverage 16.66%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
eloc 11
c 1
b 0
f 0
dl 0
loc 98
ccs 3
cts 18
cp 0.1666
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A viewAny() 0 3 1
A delete() 0 3 1
A before() 0 4 2
A forceDelete() 0 3 1
A restore() 0 3 1
A create() 0 3 1
A update() 0 3 1
A view() 0 3 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\Configuration;
6
use App\Models\Role;
7
use App\Models\User;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class ConfigurationPolicy
11
{
12
    use HandlesAuthorization;
13
14
    /**
15
     * Perform pre-authorization checks.
16
     *
17
     * @param  \App\Models\User  $user
18
     * @param  string  $ability
19
     * @return void|bool
20
     */
21 24
    public function before(User $user, $ability)
0 ignored issues
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

21
    public function before(User $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...
22
    {
23 24
        if ($user->hasRole(Role::ROLE_ADMIN)) {
24 24
            return true;
25
        }
26
    }
27
28
    /**
29
     * Determine whether the user can view any models.
30
     *
31
     * @param  \App\Models\User  $user
32
     * @return \Illuminate\Auth\Access\Response|bool
33
     */
34
    public function viewAny(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

34
    public function viewAny(/** @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...
35
    {
36
        return false;
37
    }
38
39
    /**
40
     * Determine whether the user can view the model.
41
     *
42
     * @param  \App\Models\User  $user
43
     * @param  \App\Models\Configuration  $configuration
44
     * @return \Illuminate\Auth\Access\Response|bool
45
     */
46
    public function view(User $user, Configuration $configuration)
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

46
    public function view(/** @scrutinizer ignore-unused */ User $user, Configuration $configuration)

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

46
    public function view(User $user, /** @scrutinizer ignore-unused */ Configuration $configuration)

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...
47
    {
48
        return false;
49
    }
50
51
    /**
52
     * Determine whether the user can create models.
53
     *
54
     * @param  \App\Models\User  $user
55
     * @return \Illuminate\Auth\Access\Response|bool
56
     */
57
    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

57
    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...
58
    {
59
        return false;
60
    }
61
62
    /**
63
     * Determine whether the user can update the model.
64
     *
65
     * @param  \App\Models\User  $user
66
     * @param  \App\Models\Configuration  $configuration
67
     * @return \Illuminate\Auth\Access\Response|bool
68
     */
69
    public function update(User $user, Configuration $configuration)
0 ignored issues
show
Unused Code introduced by
The parameter $configuration 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 update(User $user, /** @scrutinizer ignore-unused */ Configuration $configuration)

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

69
    public function update(/** @scrutinizer ignore-unused */ User $user, Configuration $configuration)

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
        return false;
72
    }
73
74
    /**
75
     * Determine whether the user can delete the model.
76
     *
77
     * @param  \App\Models\User  $user
78
     * @param  \App\Models\Configuration  $configuration
79
     * @return \Illuminate\Auth\Access\Response|bool
80
     */
81
    public function delete(User $user, Configuration $configuration)
0 ignored issues
show
Unused Code introduced by
The parameter $configuration 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 delete(User $user, /** @scrutinizer ignore-unused */ Configuration $configuration)

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

81
    public function delete(/** @scrutinizer ignore-unused */ User $user, Configuration $configuration)

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
        return false;
84
    }
85
86
    /**
87
     * Determine whether the user can restore the model.
88
     *
89
     * @param  \App\Models\User  $user
90
     * @param  \App\Models\Configuration  $configuration
91
     * @return \Illuminate\Auth\Access\Response|bool
92
     */
93
    public function restore(User $user, Configuration $configuration)
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

93
    public function restore(/** @scrutinizer ignore-unused */ User $user, Configuration $configuration)

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

93
    public function restore(User $user, /** @scrutinizer ignore-unused */ Configuration $configuration)

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...
94
    {
95
        return false;
96
    }
97
98
    /**
99
     * Determine whether the user can permanently delete the model.
100
     *
101
     * @param  \App\Models\User  $user
102
     * @param  \App\Models\Configuration  $configuration
103
     * @return \Illuminate\Auth\Access\Response|bool
104
     */
105
    public function forceDelete(User $user, Configuration $configuration)
0 ignored issues
show
Unused Code introduced by
The parameter $configuration 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

105
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ Configuration $configuration)

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

105
    public function forceDelete(/** @scrutinizer ignore-unused */ User $user, Configuration $configuration)

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...
106
    {
107
        return false;
108
    }
109
}
110