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

Loggable::setActionLogId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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