Test Failed
Branch 201903-scrutinizer (558be5)
by Jos
08:20
created

EnumWithCodeAndValue::identifierAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

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
1
<?php
2
3
namespace JosKolenberg\Enum;
4
5
abstract class EnumWithCodeAndValue extends Enum
6
{
7
    /**
8
     * The code for the instance.
9
     *
10
     * @var mixed
11
     */
12
    protected $code;
13
14
    /**
15
     * The value for the instance.
16
     *
17
     * @var mixed
18
     */
19
    protected $value;
20
21
    /**
22
     * AbstractEnumWithIdAndName constructor.
23
     *
24
     * @param $code
25
     * @param $value
26
     */
27
    public function __construct($code, $value)
28
    {
29
        $this->code = $code;
30
        $this->value = $value;
31
    }
32
33
    /**
34
     * Get the code attribute.
35
     *
36
     * @return mixed
37
     */
38
    public function getCode()
39
    {
40
        return $this->code;
41
    }
42
43
    /**
44
     * Get the value attribute.
45
     *
46
     * @return mixed
47
     */
48
    public function getValue()
49
    {
50
        return $this->value;
51
    }
52
53
    /**
54
     * Return the name of the attribute which stores the identifier.
55
     *
56
     * @return mixed
57
     */
58
    protected function identifierAttribute()
59
    {
60
        return 'code';
61
    }
62
}
63