|
ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Inheritance diagram for MyCLabs\Enum\Enum:
Collaboration diagram for MyCLabs\Enum\Enum:Public Member Functions | |
| __construct ($value) | |
| Creates a new value of some type. More... | |
| __wakeup () | |
| getValue () | |
| @psalm-pure More... | |
| getKey () | |
| Returns the enum key (i.e. More... | |
| __toString () | |
| @psalm-pure @psalm-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.
@psalm-template T @psalm-immutable @psalm-consistent-constructor
| MyCLabs\Enum\Enum::__construct | ( | $value | ) |
Creates a new value of some type.
@psalm-pure
| mixed | $value |
@psalm-param T $value
UnexpectedValueException if incompatible type is given.
@psalm-var T
@psalm-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 |
BadMethodCallException
@psalm-pure
Definition at line 279 of file Enum.php.
References $message, $name, and ILIAS\UI\Implementation\Component\toArray().
Referenced by MyCLabs\Enum\Enum\from().
Here is the call graph for this function:
Here is the caller graph for this function:| MyCLabs\Enum\Enum::__toString | ( | ) |
@psalm-pure @psalm-suppress InvalidCast
Definition at line 123 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
| MyCLabs\Enum\Enum::__wakeup | ( | ) |
|
static |
Asserts valid enum value.
@psalm-pure @psalm-assert T $value
Definition at line 219 of file Enum.php.
References MyCLabs\Enum\Enum\$value, and MyCLabs\Enum\Enum\assertValidValueReturningKey().
Here is the call graph for this function:
|
staticprivate |
Asserts valid enum value.
@psalm-pure @psalm-assert T $value
Definition at line 230 of file Enum.php.
References MyCLabs\Enum\Enum\$key, and MyCLabs\Enum\Enum\$value.
Referenced by MyCLabs\Enum\Enum\assertValidValue().
Here is the caller graph for this function:
|
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
@psalm-pure @psalm-param mixed $variable
Definition at line 138 of file Enum.php.
References MyCLabs\Enum\Enum\getValue().
Here is the call graph for this function:
|
static |
| mixed | $value |
Definition at line 90 of file Enum.php.
References MyCLabs\Enum\Enum\$key, MyCLabs\Enum\Enum\$value, and MyCLabs\Enum\Enum\__callStatic().
Here is the call graph for this function:| MyCLabs\Enum\Enum::getKey | ( | ) |
Returns the enum key (i.e.
the constant name).
@psalm-pure
Definition at line 113 of file Enum.php.
References MyCLabs\Enum\Enum\$key.
| MyCLabs\Enum\Enum::getValue | ( | ) |
@psalm-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().
Here is the caller graph for this function:
|
static |
Check if is valid enum value.
| $value | @psalm-param mixed $value @psalm-pure @psalm-assert-if-true T $value |
Definition at line 208 of file Enum.php.
References MyCLabs\Enum\Enum\$value, and ILIAS\UI\Implementation\Component\toArray().
Here is the call graph for this function:
|
static |
Check if is valid enum key.
| $key | @psalm-param string $key @psalm-pure |
Definition at line 247 of file Enum.php.
References MyCLabs\Enum\Enum\$key, and ILIAS\UI\Implementation\Component\toArray().
Here is the call graph for this function:| 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().
Here is the call graph for this function:
|
static |
Returns the names (keys) of all constants in the Enum class.
@psalm-pure @psalm-return list<string>
Definition at line 152 of file Enum.php.
References ILIAS\UI\Implementation\Component\toArray().
Here is the call graph for this function:
|
static |
Return key for value.
| mixed | $value |
@psalm-param mixed $value @psalm-pure
Definition at line 263 of file Enum.php.
References MyCLabs\Enum\Enum\$value, and ILIAS\UI\Implementation\Component\toArray().
Here is the call graph for this function:
|
static |
Returns all possible values as an array.
@psalm-pure @psalm-suppress ImpureStaticProperty
@psalm-return array<string, mixed>
@psalm-suppress ImpureMethodCall this reflection API usage has no side-effects here
@psalm-suppress ImpureMethodCall this reflection API usage has no side-effects here
Definition at line 185 of file Enum.php.
|
static |
Returns instances of the Enum class of all Enum constants.
@psalm-pure @psalm-return array<string, static>
@psalm-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().
Here is the call graph for this function:
|
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().