Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct ($value) | |
__toString () | |
equals ($variable=null) | |
getKey () | |
getValue () | |
jsonSerialize () | |
Static Public Member Functions | |
static | __callStatic ($name, $arguments) |
static | isValid ($value) |
static | isValidKey ($key) |
static | keys () |
static | search ($value) |
static | toArray () |
static | values () |
Protected Attributes | |
$value | |
Static Protected Attributes | |
static | $cache = [] |
Base Enum class
Create an enum by implementing this class and adding class constants.
@psalm-template T @psalm-immutable
MyCLabs\Enum\Enum::__construct | ( | $value | ) |
Creates a new value of some type
@psalm-pure
mixed | $value | @psalm-param static<T>|T $value |
Definition at line 52 of file Enum.php.
References MyCLabs\Enum\Enum\$value, and MyCLabs\Enum\Enum\isValid().
|
static |
MyCLabs\Enum\Enum::__toString | ( | ) |
@psalm-pure @psalm-suppress InvalidCast
Definition at line 94 of file Enum.php.
References 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
@psalm-pure @psalm-param mixed $variable
Definition at line 109 of file Enum.php.
References MyCLabs\Enum\Enum\getValue().
MyCLabs\Enum\Enum::getKey | ( | ) |
MyCLabs\Enum\Enum::getValue | ( | ) |
@psalm-pure
Definition at line 73 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 | @psalm-param mixed $value @psalm-pure |
Definition at line 176 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
Referenced by MyCLabs\Enum\Enum\__construct().
|
static |
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 238 of file Enum.php.
References MyCLabs\Enum\Enum\getValue().
|
static |
|
static |
Return key for value
$value | @psalm-param mixed $value @psalm-pure |
Definition at line 205 of file Enum.php.
References MyCLabs\Enum\Enum\$value.
|
static |
|
static |
|
protected |
Enum value
@psalm-var T
Definition at line 32 of file Enum.php.
Referenced by MyCLabs\Enum\Enum\__construct(), MyCLabs\Enum\Enum\__toString(), MyCLabs\Enum\Enum\getValue(), MyCLabs\Enum\Enum\isValid(), MyCLabs\Enum\Enum\search(), and MyCLabs\Enum\Enum\values().