Total Complexity | 4 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 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 | 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() |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Return the name of the attribute which stores the identifier. |
||
55 | * |
||
56 | * @return mixed |
||
57 | */ |
||
58 | protected function identifierAttribute() |
||
63 |