Version
extends Enum
in package
Class Version
Tags
Table of Contents
Constants
Properties
- $cache : array<string|int, mixed>
- Store existing constants in a static cache per object.
- $instances : array<string|int, mixed>
- Cache of instances of the Enum class
- $value : mixed
- Enum value
- $key : string
- Enum key, the constant name
Methods
- __callStatic() : static
- Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant
- __construct() : mixed
- Creates a new value of some type
- __toString() : string
- __wakeup() : mixed
- This method exists only for the compatibility reason when deserializing a previously serialized version that didn't had the key property
- assertValidValue() : void
- Asserts valid enum value
- equals() : bool
- Determines if Enum should be considered equal with the variable passed as a parameter.
- from() : static
- getKey() : string
- Returns the enum key (i.e. the constant name).
- getValue() : mixed
- isValid() : bool
- Check if is valid enum value
- isValidKey() : bool
- Check if is valid enum key
- jsonSerialize() : mixed
- Specify data which should be serialized to JSON. This method returns data that can be serialized by json_encode() natively.
- keys() : array<string|int, mixed>
- Returns the names (keys) of all constants in the Enum class
- search() : string|false
- Return key for value
- toArray() : array<string|int, mixed>
- Returns all possible values as an array
- values() : array<string|int, static>
- Returns instances of the Enum class of all Enum constants
- assertValidValueReturningKey() : string
- Asserts valid enum value
Constants
DEFLATE
public
mixed
DEFLATE
= 0x14
STORE
public
mixed
STORE
= 0xa
ZIP64
public
mixed
ZIP64
= 0x2d
Properties
$cache
Store existing constants in a static cache per object.
protected
static array<string|int, mixed>
$cache
= []
Tags
$instances
Cache of instances of the Enum class
protected
static array<string|int, mixed>
$instances
= []
Tags
$value
Enum value
protected
mixed
$value
Tags
$key
Enum key, the constant name
private
string
$key
Methods
__callStatic()
Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant
public
static __callStatic(string $name, array<string|int, mixed> $arguments) : static
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Tags
Return values
static__construct()
Creates a new value of some type
public
__construct(mixed $value) : mixed
Parameters
- $value : mixed
Tags
__toString()
public
__toString() : string
Tags
Return values
string__wakeup()
This method exists only for the compatibility reason when deserializing a previously serialized version that didn't had the key property
public
__wakeup() : mixed
assertValidValue()
Asserts valid enum value
public
static assertValidValue(mixed $value) : void
Parameters
- $value : mixed
Tags
equals()
Determines if Enum should be considered equal with the variable passed as a parameter.
public
final equals([mixed $variable = null ]) : bool
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
Parameters
- $variable : mixed = null
Tags
Return values
boolfrom()
public
static from(mixed $value) : static
Parameters
- $value : mixed
Return values
staticgetKey()
Returns the enum key (i.e. the constant name).
public
getKey() : string
Tags
Return values
stringgetValue()
public
getValue() : mixed
Tags
isValid()
Check if is valid enum value
public
static isValid(mixed $value) : bool
Parameters
- $value : mixed
Tags
Return values
boolisValidKey()
Check if is valid enum key
public
static isValidKey(mixed $key) : bool
Parameters
- $key : mixed
Tags
Return values
booljsonSerialize()
Specify data which should be serialized to JSON. This method returns data that can be serialized by json_encode() natively.
public
jsonSerialize() : mixed
Tags
Attributes
keys()
Returns the names (keys) of all constants in the Enum class
public
static keys() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>search()
Return key for value
public
static search(mixed $value) : string|false
Parameters
- $value : mixed
Tags
Return values
string|falsetoArray()
Returns all possible values as an array
public
static toArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Constant name in key, constant value in value
values()
Returns instances of the Enum class of all Enum constants
public
static values() : array<string|int, static>
Tags
Return values
array<string|int, static> —Constant name in key, Enum instance in value
assertValidValueReturningKey()
Asserts valid enum value
private
static assertValidValueReturningKey(mixed $value) : string
Parameters
- $value : mixed