ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct ($value) | |
Creates a new value of some type. More... | |
__wakeup () | |
getValue () | |
-pure More... | |
getKey () | |
Returns the enum key (i.e. More... | |
__toString () | |
-pure -suppress InvalidCast More... | |
equals ($variable=null) | |
Determines if Enum should be considered equal with the variable passed as a parameter. More... | |
jsonSerialize () | |
Specify data which should be serialized to JSON. More... | |
Static Public Member Functions | |
static | from ($value) |
static | keys () |
Returns the names (keys) of all constants in the Enum class. More... | |
static | values () |
Returns instances of the Enum class of all Enum constants. More... | |
static | toArray () |
Returns all possible values as an array. More... | |
static | isValid ($value) |
Check if is valid enum value. More... | |
static | assertValidValue ($value) |
Asserts valid enum value. More... | |
static | isValidKey ($key) |
Check if is valid enum key. More... | |
static | search ($value) |
Return key for value. More... | |
static | __callStatic ($name, $arguments) |
Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant. More... | |
Protected Attributes | |
$value | |
Static Protected Attributes | |
static | $cache = [] |
static | $instances = [] |
Static Private Member Functions | |
static | assertValidValueReturningKey ($value) |
Asserts valid enum value. More... | |
Private Attributes | |
$key | |
Create an enum by implementing this class and adding class constants.
-template T -immutable -consistent-constructor
MyCLabs\Enum\Enum::__construct | ( | $value | ) |
Creates a new value of some type.
-pure
mixed | $value | -param T $value |
-var T
-var T
Definition at line 65 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
|
static |
Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant.
string | $name | |
array | $arguments |
Definition at line 279 of file Enum.php.
References $message, $name, and ILIAS\UI\Implementation\Component\toArray().
MyCLabs\Enum\Enum::__toString | ( | ) |
-pure -suppress InvalidCast
Definition at line 123 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
MyCLabs\Enum\Enum::__wakeup | ( | ) |
|
static |
Asserts valid enum value.
-pure -assert T $value
Definition at line 219 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
|
staticprivate |
Asserts valid enum value.
-pure -assert T $value
Definition at line 230 of file Enum.php.
References MyCLabs\Enum\Enum\$key, and MyCLabs\Enum\Enum\$value.
|
final |
Determines if Enum should be considered equal with the variable passed as a parameter.
Returns false if an argument is an object of different class or not an object.
This method is final, for more information read https://github.com/myclabs/php-enum/issues/4
-pure -param mixed $variable
Definition at line 138 of file Enum.php.
References MyCLabs\Enum\Enum\getValue().
|
static |
mixed | $value |
Definition at line 90 of file Enum.php.
References MyCLabs\Enum\Enum\$key, and MyCLabs\Enum\Enum\$value.
MyCLabs\Enum\Enum::getKey | ( | ) |
Returns the enum key (i.e.
the constant name).
-pure
Definition at line 113 of file Enum.php.
References MyCLabs\Enum\Enum\$key.
MyCLabs\Enum\Enum::getValue | ( | ) |
-pure
Definition at line 102 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
Referenced by MyCLabs\Enum\Enum\equals(), and MyCLabs\Enum\Enum\jsonSerialize().
|
static |
Check if is valid enum value.
$value | -param mixed $value -pure -assert-if-true T $value |
Definition at line 208 of file Enum.php.
References MyCLabs\Enum\Enum\$value, and ILIAS\UI\Implementation\Component\toArray().
|
static |
Check if is valid enum key.
$key | -param string $key -pure |
Definition at line 247 of file Enum.php.
References MyCLabs\Enum\Enum\$key, and ILIAS\UI\Implementation\Component\toArray().
MyCLabs\Enum\Enum::jsonSerialize | ( | ) |
Specify data which should be serialized to JSON.
This method returns data that can be serialized by json_encode() natively.
Definition at line 301 of file Enum.php.
References MyCLabs\Enum\Enum\getValue().
|
static |
Returns the names (keys) of all constants in the Enum class.
-pure -return list<string>
Definition at line 152 of file Enum.php.
References ILIAS\UI\Implementation\Component\toArray().
|
static |
Return key for value.
mixed | $value | -param mixed $value -pure |
Definition at line 263 of file Enum.php.
References MyCLabs\Enum\Enum\$value, and ILIAS\UI\Implementation\Component\toArray().
|
static |
Returns all possible values as an array.
-pure -suppress ImpureStaticProperty
-return array<string, mixed>
-suppress ImpureMethodCall this reflection API usage has no side-effects here
-suppress ImpureMethodCall this reflection API usage has no side-effects here
|
static |
Returns instances of the Enum class of all Enum constants.
-pure -return array<string, static>
-var T $value
Definition at line 164 of file Enum.php.
References MyCLabs\Enum\Enum\$key, MyCLabs\Enum\Enum\$value, $values, and ILIAS\UI\Implementation\Component\toArray().
|
private |
Definition at line 37 of file Enum.php.
Referenced by MyCLabs\Enum\Enum\assertValidValueReturningKey(), MyCLabs\Enum\Enum\from(), MyCLabs\Enum\Enum\getKey(), MyCLabs\Enum\Enum\isValidKey(), and MyCLabs\Enum\Enum\values().
|
protected |
Definition at line 30 of file Enum.php.
Referenced by MyCLabs\Enum\Enum\__construct(), MyCLabs\Enum\Enum\__toString(), MyCLabs\Enum\Enum\assertValidValue(), MyCLabs\Enum\Enum\assertValidValueReturningKey(), MyCLabs\Enum\Enum\from(), MyCLabs\Enum\Enum\getValue(), MyCLabs\Enum\Enum\isValid(), MyCLabs\Enum\Enum\search(), and MyCLabs\Enum\Enum\values().