Completed
Push — master ( 6d1120...3e38c4 )
by Michal
10s
created

AbstractDataManager   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 73
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteItem() 0 4 1
A deleteTable() 0 4 1
A deleteDatabase() 0 4 1
A execute() 0 4 1
A getMessages() 0 4 1
A addMessage() 0 4 1
1
<?php
2
3
namespace UniMan\Core\DataManager;
4
5
abstract class AbstractDataManager implements DataManagerInterface
6
{
7
    /**
8
     * @var array list of messages in format flash message => type of flash message (info, success, warning, danger)
9
     */
10
    protected $messages = [];
11
12
    /**
13
     * Implement this method if permission canDeleteItem is true
14
     * @param string $type
15
     * @param string $table
16
     * @param string $item
17
     * @return boolean|null
18
     * @see DataManagerInterface
19
     */
20
    public function deleteItem($type, $table, $item)
21
    {
22
        return null;
23
    }
24
25
    /**
26
     * Implement this method if permission canDeleteTable is true
27
     * @param string $type
28
     * @param string $table
29
     * @return boolean|null
30
     * @see DataManagerInterface
31
     */
32
    public function deleteTable($type, $table)
33
    {
34
        return null;
35
    }
36
37
    /**
38
     * Implement this method if permission canDeleteDatabase is true
39
     * @param string $database
40
     * @return boolean|null
41
     * @see DataManagerInterface
42
     */
43
    public function deleteDatabase($database)
44
    {
45
        return null;
46
    }
47
48
    /**
49
     * Implement this method if permission canExecuteCommands is true
50
     * @param string $commands
51
     * @return array|null
52
     * @see DataManagerInterface
53
     */
54
    public function execute($commands)
55
    {
56
        return null;
57
    }
58
59
    /**
60
     * @return array
61
     * @see DataManagerInterface
62
     */
63
    final public function getMessages()
64
    {
65
        return $this->messages;
66
    }
67
68
    /**
69
     * add message to list of messages
70
     * @param string $message
71
     * @param string $type
72
     */
73
    final protected function addMessage($message, $type = 'info')
74
    {
75
        $this->messages[$message] = $type;
76
    }
77
}
78