ArrayAccessTrait
A generic implementation of the ArrayAccess interface.
Tags
Table of Contents
Properties
- $data : TData
- Holds the array-accessible data.
Methods
- offsetExists() : bool
- Check if the specified offset exists.
- offsetGet() : TValue|null
- Retrieve data at the specified offset.
- offsetSet() : void
- Assign a value to the specified offset.
- offsetUnset() : void
- Unset the specified offset.
Properties
$data
Holds the array-accessible data.
protected
TData
$data
= []
Methods
offsetExists()
Check if the specified offset exists.
public
offsetExists(TKey $offset) : bool
APIYes
Parameters
- $offset : TKey
-
The offset to check for
Return values
bool —Whether the offset exists
offsetGet()
Retrieve data at the specified offset.
public
offsetGet(TKey $offset) : TValue|null
APIYes
Parameters
- $offset : TKey
-
The offset to retrieve at
Return values
TValue|null —The value at the offset or NULL
offsetSet()
Assign a value to the specified offset.
public
offsetSet(TKey|null $offset, TValue $value) : void
APIYes
Parameters
- $offset : TKey|null
-
The offset to assign to or NULL to append
- $value : TValue
-
The value to set
offsetUnset()
Unset the specified offset.
public
offsetUnset(TKey $offset) : void
APIYes
Parameters
- $offset : TKey
-
The offset to unset