Completed
Pull Request — master (#22)
by Michal
02:36
created

RedisPermissions   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 12.5%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 0
loc 42
ccs 2
cts 16
cp 0.125
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A canCreateItem() 0 4 1
A canEditItem() 0 4 1
A canDeleteItem() 0 4 1
A canCreateTable() 0 4 1
A canEditTable() 0 4 1
A canDeleteTable() 0 4 1
A canEditDatabase() 0 4 1
A canExecuteCommands() 0 4 1
1
<?php
2
3
namespace UniMan\Drivers\Redis;
4
5
use UniMan\Core\Permissions\DefaultPermissions;
6
7
class RedisPermissions extends DefaultPermissions
8
{
9
    public function canCreateItem($database, $type, $table)
10
    {
11
        return true;
12
    }
13
14
    public function canEditItem($database, $type, $table, $item = null)
15
    {
16
        return true;
17
    }
18
19
    public function canDeleteItem($database, $type, $table, $item)
20
    {
21
        return true;
22
    }
23
24
    public function canCreateTable($database, $type)
25
    {
26
        return $type !== RedisDriver::TYPE_KEY;
27
    }
28
29
    public function canEditTable($database, $type, $table)
30
    {
31
        return $type !== RedisDriver::TYPE_KEY;
32
    }
33
34
    public function canDeleteTable($database, $type, $table)
35
    {
36
        return $type !== RedisDriver::TYPE_KEY;
37
    }
38
39 2
    public function canEditDatabase($database)
40
    {
41 2
        return true;
42
    }
43
44
    public function canExecuteCommands()
45
    {
46
        return true;
47
    }
48
}
49