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

Loggable::getAliasName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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