Rules
in package
implements
ArrayAccess, JsonSerializable
Class Rules
This class implements the ArrayAccess and JsonSerializable interfaces and provides methods for managing game rules data.
Table of Contents
Interfaces
- ArrayAccess
- JsonSerializable
Properties
Methods
- __construct() : mixed
- Rules constructor.
- jsonSerialize() : array<string|int, mixed>
- Specifies the data to be serialized to JSON.
- offsetExists() : bool
- Checks if an offset exists in the data array.
- offsetGet() : string
- Gets the value at the specified offset in the data array.
- offsetSet() : void
- Sets a value at the specified offset in the data array.
- offsetUnset() : void
- Unsets an offset in the data array.
Properties
$mutators
public
array<string|int, mixed>
$mutators
Stores the mutators data.
$data
private
array<string|int, mixed>
$data
The main data storage.
Methods
__construct()
Rules constructor.
public
__construct() : mixed
Initializes the data and mutators arrays.
jsonSerialize()
Specifies the data to be serialized to JSON.
public
jsonSerialize() : array<string|int, mixed>
This method is called automatically by json_encode().
Return values
array<string|int, mixed> —The data to be serialized.
offsetExists()
Checks if an offset exists in the data array.
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
-
The offset to check.
Return values
bool —True if the offset exists, false otherwise.
offsetGet()
Gets the value at the specified offset in the data array.
public
offsetGet(mixed $offset) : string
Parameters
- $offset : mixed
-
The offset to get the value from.
Return values
string —The value at the specified offset or null if the offset does not exist.
offsetSet()
Sets a value at the specified offset in the data array.
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
-
The offset where the value should be set.
- $value : mixed
-
The value to set.
offsetUnset()
Unsets an offset in the data array.
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
-
The offset to unset.