Passed
Push — issue#767 ( 011dde...50feef )
by Guilherme
05:46
created

Loggable   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setType() 0 5 1
A getActionLogId() 0 3 1
A setActionLogId() 0 5 1
A getAliasName() 0 3 1
B getType() 0 11 6
A allowArray() 0 3 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 1
    public function allowArray()
18
    {
19 1
        return true;
20
    }
21
22 1
    public function getAliasName()
23
    {
24 1
        return "loggable";
25
    }
26
27 4
    public function setType($type)
28
    {
29 4
        $this->type = $type;
30
31 4
        return $this->type;
32
    }
33
34 1
    public function getType()
35
    {
36 1
        switch ($this->type) {
37 1
            case ActionLog::TYPE_CREATE:
38 1
            case ActionLog::TYPE_DELETE:
39 1
            case ActionLog::TYPE_SELECT:
40 1
            case ActionLog::TYPE_UPDATE:
41 1
            case ActionLog::TYPE_LOGIN:
42 1
                return $this->type;
43
            default:
44 1
                return "UNKNOWN";
45
        }
46
    }
47
48 3
    public function setActionLogId($id)
49
    {
50 3
        $this->actionLogId = $id;
51
52 3
        return $this;
53
    }
54
55 2
    public function getActionLogId()
56
    {
57 2
        return $this->actionLogId;
58
    }
59
60
}
61