Passed
Pull Request — master (#17)
by ARCANEDEV
05:21
created

MediaPolicy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 58
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 2 1
A prefix() 0 3 1
A abilities() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanesoft\Media\Policies;
6
7
use Arcanesoft\Foundation\Auth\Models\Administrator;
8
use Arcanesoft\Foundation\Support\Auth\Policy;
9
10
/**
11
 * Class     MediaPolicy
12
 *
13
 * @package  Arcanesoft\Media\Policies
14
 * @author   ARCANEDEV <[email protected]>
15
 */
16
class MediaPolicy extends Policy
17
{
18
    /* -----------------------------------------------------------------
19
     |  Getters
20
     | -----------------------------------------------------------------
21
     */
22
23
    /**
24
     * Get the ability's prefix.
25
     *
26
     * @return string
27
     */
28
    protected static function prefix(): string
29
    {
30
        return 'admin::media.';
31
    }
32
33
    /* -----------------------------------------------------------------
34
     |  Main Methods
35
     | -----------------------------------------------------------------
36
     */
37
38
    /**
39
     * Get the policy's abilities.
40
     *
41
     * @return \Arcanedev\LaravelPolicies\Ability[]|iterable
42
     */
43
    public function abilities(): iterable
44
    {
45
        $this->setMetas([
46
            'category' => 'Media',
47
        ]);
48
49
        return [
50
51
            // admin::media.index
52
            $this->makeAbility('index')->setMetas([
53
                'name'        => 'Access the main media manager',
54
                'description' => 'Ability to access the main media manager',
55
            ]),
56
57
        ];
58
    }
59
60
    /* -----------------------------------------------------------------
61
     |  Policies
62
     | -----------------------------------------------------------------
63
     */
64
65
    /**
66
     * Allow to access the main media manager.
67
     *
68
     * @param  \Arcanesoft\Foundation\Auth\Models\Administrator|mixed  $administrator
69
     *
70
     * @return \Illuminate\Auth\Access\Response|bool|void
71
     */
72
    public function index(Administrator $administrator)
0 ignored issues
show
Unused Code introduced by
The parameter $administrator 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

72
    public function index(/** @scrutinizer ignore-unused */ Administrator $administrator)

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...
73
    {
74
        //
75
    }
76
}
77