@@ -13,7 +13,7 @@ It's an abstract class that can be extended to emulate enumerables.
13
13
14
14
# API
15
15
16
- Enum
16
+ Mabe_Enum
17
17
{
18
18
protected $value = null;
19
19
final public function __construct($value = null);
@@ -29,7 +29,7 @@ It's an abstract class that can be extended to emulate enumerables.
29
29
## Examples:
30
30
31
31
// Enum with ONE as default value
32
- class MyEnumWithDefaultValue
32
+ class MyEnumWithDefaultValue extends Mabe_Enum
33
33
{
34
34
const ONE = 1;
35
35
const TWO = 2;
@@ -38,23 +38,23 @@ It's an abstract class that can be extended to emulate enumerables.
38
38
39
39
// Enum without a default value
40
40
// No argument on constructor results in InvalidArgumentException
41
- class MyEnumWithoutDefaultValue
41
+ class MyEnumWithoutDefaultValue extends Mabe_Enum
42
42
{
43
43
const ONE = 1;
44
44
const TWO = 2;
45
45
}
46
46
47
47
// Because the $value object property is defined as NULL
48
48
// a constant with a NULL value gets the default value automatically
49
- class MyEnumWithNullAsDefaultValue
49
+ class MyEnumWithNullAsDefaultValue extends Mabe_Enum
50
50
{
51
51
const NONE = null;
52
52
const ONE = 1;
53
53
const TWO = 2;
54
54
}
55
55
56
56
// To disable the last behavior it's possible to set the default value to an unknown value
57
- class MyEnumWithoutNullAsDefaultValue
57
+ class MyEnumWithoutNullAsDefaultValue extends Mabe_Enum
58
58
{
59
59
const NONE = null;
60
60
const ONE = 1;
@@ -105,7 +105,7 @@ It's an abstract class that can be extended to emulate enumerables.
105
105
106
106
## The way of php-enum:
107
107
108
- class UserStatusEnum extends Enum
108
+ class UserStatusEnum extends Mabe_Enum
109
109
{
110
110
const INACTIVE = 0;
111
111
const ACTIVE = 1;
@@ -143,7 +143,7 @@ It's an abstract class that can be extended to emulate enumerables.
143
143
Default user status: INACTIVE (0)
144
144
Changed user status: ACTIVE (1)
145
145
146
- * Validation already done on basic class ``` Enum ```
146
+ * Validation already done on basic class ``` Mabe_Enum ```
147
147
* Using type-hint makes arguments save
148
148
* Human readable name of a value is simple accessable
149
149
0 commit comments