Passed
Push — master ( 380517...f13cd3 )
by Peter
09:19
created

FileCategoryProvider::savePolicy()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Files\Authorization;
6
7
use AbterPhp\Admin\Authorization\PolicyProviderTrait;
8
use Casbin\Exceptions\CasbinException;
9
use Casbin\Model\Model;
10
use Casbin\Persist\Adapter as CasbinAdapter;
11
use AbterPhp\Files\Databases\Queries\FileCategoryAuthLoader as AuthLoader;
12
13
class FileCategoryProvider implements CasbinAdapter
14
{
15
    use PolicyProviderTrait;
0 ignored issues
show
Bug introduced by
The trait AbterPhp\Admin\Authorization\PolicyProviderTrait requires the property $model which is not provided by AbterPhp\Files\Authorization\FileCategoryProvider.
Loading history...
16
17
    const PREFIX = 'file_category';
18
19
    /** @var AuthLoader */
20
    protected $authLoader;
21
22
    /**
23
     * FileCategory constructor.
24
     *
25
     * @param AuthLoader $authLoader
26
     */
27
    public function __construct(AuthLoader $authLoader)
28
    {
29
        $this->authLoader = $authLoader;
30
        $this->prefix     = static::PREFIX;
31
    }
32
33
    /**
34
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
35
     *
36
     * @param Model $model
37
     *
38
     * @return bool
39
     */
40
    public function savePolicy($model)
41
    {
42
        return true;
43
    }
44
45
    /**
46
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
47
     *
48
     * @param string $sec
49
     * @param string $ptype
50
     * @param array  $rule
51
     *
52
     * @return void
53
     */
54
    public function addPolicy($sec, $ptype, $rule)
55
    {
56
        return;
57
    }
58
59
    /**
60
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
61
     *
62
     * @param string $sec
63
     * @param string $ptype
64
     * @param array  $rule
65
     *
66
     * @return int
67
     */
68
    public function removePolicy($sec, $ptype, $rule)
69
    {
70
        $count = 0;
71
72
        return $count;
73
    }
74
75
    /**
76
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
77
     *
78
     * @param       $sec
79
     * @param       $ptype
80
     * @param       $fieldIndex
81
     * @param mixed ...$fieldValues
82
     *
83
     * @throws CasbinException
84
     */
85
    public function removeFilteredPolicy($sec, $ptype, $fieldIndex, ...$fieldValues)
86
    {
87
        throw new CasbinException('not implemented');
88
    }
89
}
90