Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
5 | abstract class EnumWithId extends Enum |
||
6 | { |
||
7 | /** |
||
8 | * The identifier for the instance. |
||
9 | * |
||
10 | * @var mixed |
||
11 | */ |
||
12 | protected $id; |
||
13 | |||
14 | /** |
||
15 | * AbstractEnumWithId constructor. |
||
16 | * |
||
17 | * @param $id |
||
18 | */ |
||
19 | 4 | public function __construct($id) |
|
20 | { |
||
21 | 4 | $this->id = $id; |
|
22 | 2 | } |
|
23 | |||
24 | /** |
||
25 | * Get the id attribute. |
||
26 | * |
||
27 | * @return mixed |
||
28 | */ |
||
29 | 2 | public function getId() |
|
30 | { |
||
31 | 2 | return $this->id; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Return the name of the attribute which stores the identifier. |
||
36 | * |
||
37 | * @return mixed |
||
38 | */ |
||
39 | 14 | protected function identifierAttribute() |
|
42 | } |
||
43 | } |
||
44 |