Completed
Pull Request — master (#3)
by ARCANEDEV
16:54
created

StatusesPolicy::abilities()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 34

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 0
cts 6
cp 0
rs 9.376
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanesoft\Backups\Policies;
6
7
use Arcanesoft\Foundation\Auth\Models\Administrator;
8
use Arcanesoft\Foundation\Support\Auth\Policy;
9
10
/**
11
 * Class     StatusesPolicy
12
 *
13
 * @author   ARCANEDEV <[email protected]>
14
 */
15
class StatusesPolicy extends Policy
16
{
17
    /* -----------------------------------------------------------------
18
     |  Getters
19
     | -----------------------------------------------------------------
20
     */
21
22
    /**
23
     * Get the ability's prefix.
24
     *
25
     * @return string
26
     */
27
    protected static function prefix(): string
28
    {
29
        return 'admin::backups.statuses.';
30
    }
31
32
    /* -----------------------------------------------------------------
33
     |  Main Methods
34
     | -----------------------------------------------------------------
35
     */
36
37
    /**
38
     * Get the policy's abilities.
39
     *
40
     * @return \Arcanedev\LaravelPolicies\Ability[]|iterable
41
     */
42
    public function abilities(): iterable
43
    {
44
        $this->setMetas([
45
            'category' => 'Statuses',
46
        ]);
47
48
        return [
49
50
            // admin::backups.statuses.index
51
            $this->makeAbility('index')->setMetas([
52
                'name'        => 'Show all backup statuses',
53
                'description' => 'Ability to list all backup statuses',
54
            ]),
55
56
            // admin::backups.statuses.show
57
            $this->makeAbility('show')->setMetas([
58
                'name'        => 'Show a backup status',
59
                'description' => 'Ability to show a backup status',
60
            ]),
61
62
            // admin::backups.statuses.create
63
            $this->makeAbility('create')->setMetas([
64
                'name'        => 'Create a backup',
65
                'description' => 'Ability to create a backup',
66
            ]),
67
68
            // admin::backups.statuses.clean
69
            $this->makeAbility('clean')->setMetas([
70
                'name'        => 'Clean backups',
71
                'description' => 'Ability to clean old backups',
72
            ]),
73
74
        ];
75
    }
76
77
    /* -----------------------------------------------------------------
78
     |  Abilities
79
     | -----------------------------------------------------------------
80
     */
81
82
    /**
83
     * Allow to list all the backups.
84
     *
85
     * @param  \Arcanesoft\Foundation\Auth\Models\Administrator|mixed  $administrator
86
     *
87
     * @return \Illuminate\Auth\Access\Response|bool|void
88
     */
89
    public function index(Administrator $administrator)
0 ignored issues
show
Unused Code introduced by
The parameter $administrator is not used and could be removed.

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

Loading history...
90
    {
91
        //
92
    }
93
94
    /**
95
     * Allow to display a backup.
96
     *
97
     * @param  \Arcanesoft\Foundation\Auth\Models\Administrator|mixed  $administrator
98
     *
99
     * @return \Illuminate\Auth\Access\Response|bool|void
100
     */
101
    public function show(Administrator $administrator)
0 ignored issues
show
Unused Code introduced by
The parameter $administrator is not used and could be removed.

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

Loading history...
102
    {
103
        //
104
    }
105
106
    /**
107
     * Allow to create a backup.
108
     *
109
     * @param  \Arcanesoft\Foundation\Auth\Models\Administrator|mixed  $administrator
110
     *
111
     * @return \Illuminate\Auth\Access\Response|bool|void
112
     */
113
    public function create(Administrator $administrator)
0 ignored issues
show
Unused Code introduced by
The parameter $administrator is not used and could be removed.

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

Loading history...
114
    {
115
        //
116
    }
117
118
    /**
119
     * Allow to clean backups.
120
     *
121
     * @param  \Arcanesoft\Foundation\Auth\Models\Administrator|mixed  $administrator
122
     *
123
     * @return \Illuminate\Auth\Access\Response|bool|void
124
     */
125
    public function clean(Administrator $administrator)
0 ignored issues
show
Unused Code introduced by
The parameter $administrator is not used and could be removed.

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

Loading history...
126
    {
127
        //
128
    }
129
}
130