@@ -17,25 +17,29 @@ abstract class Enum
17
17
{
18
18
/**
19
19
* The selected value
20
+ *
20
21
* @var null|scalar
21
22
*/
22
23
private $ value ;
23
24
24
25
/**
25
26
* The ordinal number of the value
27
+ *
26
28
* @var null|int
27
29
*/
28
30
private $ ordinal ;
29
31
30
32
/**
31
33
* An array of available constants by class
34
+ *
32
35
* @var array ["$class" => ["$const" => $value, ...], ...]
33
36
*/
34
37
private static $ constants = array ();
35
38
36
39
/**
37
40
* Already instantiated enums
38
- * @param array ["$class.$value" => MabeEnum\Enum, ...]
41
+ *
42
+ * @var array ["$class" => ["$const" => $instance, ...], ...]
39
43
*/
40
44
private static $ instances = array ();
41
45
@@ -53,6 +57,7 @@ final private function __construct($value, $ordinal = null)
53
57
54
58
/**
55
59
* Get the current selected constant name
60
+ *
56
61
* @return string
57
62
* @see getName()
58
63
*/
@@ -72,6 +77,7 @@ final private function __clone()
72
77
73
78
/**
74
79
* Get the current selected value
80
+ *
75
81
* @return mixed
76
82
*/
77
83
final public function getValue ()
@@ -81,6 +87,7 @@ final public function getValue()
81
87
82
88
/**
83
89
* Get the current selected constant name
90
+ *
84
91
* @return string
85
92
*/
86
93
final public function getName ()
@@ -90,6 +97,7 @@ final public function getName()
90
97
91
98
/**
92
99
* Get the ordinal number of the selected value
100
+ *
93
101
* @return int
94
102
*/
95
103
final public function getOrdinal ()
@@ -208,7 +216,8 @@ final static public function clear()
208
216
}
209
217
210
218
/**
211
- * Get all available constants
219
+ * Get all available constants of the called class
220
+ *
212
221
* @return array
213
222
* @throws LogicException On ambiguous constant values
214
223
*/
@@ -219,6 +228,7 @@ final static public function getConstants()
219
228
220
229
/**
221
230
* Detect constants available by given class
231
+ *
222
232
* @param string $class
223
233
* @return array
224
234
* @throws LogicException On ambiguous constant values
0 commit comments