Total Complexity | 4 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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 | 2 | public function __construct($code, $value) |
|
28 | { |
||
29 | 2 | $this->code = $code; |
|
30 | 2 | $this->value = $value; |
|
31 | 1 | } |
|
32 | |||
33 | /** |
||
34 | * Get the code attribute. |
||
35 | * |
||
36 | * @return mixed |
||
37 | */ |
||
38 | 2 | public function getCode() |
|
39 | { |
||
40 | 2 | return $this->code; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * Get the value attribute. |
||
45 | * |
||
46 | * @return mixed |
||
47 | */ |
||
48 | 4 | public function getValue() |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * Return the name of the attribute which stores the identifier. |
||
55 | * |
||
56 | * @return mixed |
||
57 | */ |
||
58 | 6 | protected function identifierAttribute() |
|
63 |