Passed
Push — issue#767 ( 19cc40...08b279 )
by Guilherme
08:05
created

Loggable   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 38.1%

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 8
cts 21
cp 0.381
rs 10
c 0
b 0
f 0
wmc 11

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getAliasName() 0 3 1
B getType() 0 11 6
A setType() 0 5 1
A allowArray() 0 3 1
A getActionLogId() 0 3 1
A setActionLogId() 0 5 1
1
<?php
2
3
namespace LoginCidadao\APIBundle\Security\Audit\Annotation;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationAnnotation;
6
use LoginCidadao\APIBundle\Entity\ActionLog;
7
8
/**
9
 * @Annotation
10
 */
11
class Loggable extends ConfigurationAnnotation
12
{
13
14
    protected $type;
15
    private $actionLogId;
16
17
    public function allowArray()
18
    {
19
        return true;
20
    }
21
22
    public function getAliasName()
23
    {
24
        return "loggable";
25
    }
26
27 1
    public function setType($type)
28
    {
29 1
        $this->type = $type;
30
31 1
        return $this->type;
32
    }
33
34
    public function getType()
35
    {
36
        switch ($this->type) {
37
            case ActionLog::TYPE_CREATE:
38
            case ActionLog::TYPE_DELETE:
39
            case ActionLog::TYPE_SELECT:
40
            case ActionLog::TYPE_UPDATE:
41
            case ActionLog::TYPE_LOGIN:
42
                return $this->type;
43
            default:
44
                return "UNKNOWN";
45
        }
46
    }
47
48 1
    public function setActionLogId($id)
49
    {
50 1
        $this->actionLogId = $id;
51
52 1
        return $this;
53
    }
54
55 1
    public function getActionLogId()
56
    {
57 1
        return $this->actionLogId;
58
    }
59
60
}
61