RecursiveArrayAccess
in package
implements
ArrayAccess, Countable, Iterator
Wrapper class for the recursive array
Tags
Table of Contents
Interfaces
- ArrayAccess
- Countable
- Iterator
Properties
- $callableOnGet : callable
- Callable funtion on offsetGet
- $callableOnSanitizeKey : callable
- Callable function on callableOnSanitizeKey
- $callableOnSet : callable
- Callable funtion on offsetSet
- $callableOnUnset : callable
- Callable funtion on offsetUnset
- $callableOnValidateKey : callable
- Callable function on callableOnValidateKey
- $data : array<string|int, mixed>
- Internal data array.
- $dirt : array<string|int, mixed>
- $id : int
- $offset : string
- Path of the current array
- $parentId : int
Methods
- __construct() : mixed
- Default object constructor.
- clean() : mixed
- Empties the offset with values which were changed.
- count() : int
- Get the count of elements in the container array.
- current() : mixed
- Current position of the array.
- isDirty() : bool
- Checks if a value is dirty.
- key() : mixed
- Key of the current element.
- next() : void
- Move the internal point of the container array to the next item
- offsetExists() : bool
- check a offset exists
- offsetGet() : mixed
- Offset to retrieve
- offsetSet() : void
- Offset to set
- offsetUnset() : null
- Offset to unset
- pollute() : mixed
- Pollutes a value.
- recursiveOffsetExists() : bool
- This function checks if the value of an array-index, which is not on first level of the main array, is set e.g $array['level1']['level2']['level3']
- recursiveOffsetGet() : mixed
- This function returns the value of an array-index which is not on first level of the main array e.g $array['level1']['level2']['level3']
- recursiveOffsetSet() : mixed
- This function sets the value of an array-index which is not on first level of the main array e.g $array['level1']['level2']['level3'] If the previous index i.e ['level1'] is not set it will be set to array.
- rewind() : void
- Rewind the internal point of the container array.
- toArray() : array<string|int, mixed>
- Output the data as a multidimensional array.
- valid() : bool
- Is the current key valid?
Properties
$callableOnGet
Callable funtion on offsetGet
protected
callable
$callableOnGet
$callableOnSanitizeKey
Callable function on callableOnSanitizeKey
protected
callable
$callableOnSanitizeKey
$callableOnSet
Callable funtion on offsetSet
protected
callable
$callableOnSet
$callableOnUnset
Callable funtion on offsetUnset
protected
callable
$callableOnUnset
$callableOnValidateKey
Callable function on callableOnValidateKey
protected
callable
$callableOnValidateKey
$data
Internal data array.
protected
array<string|int, mixed>
$data
= array()
$dirt
protected
array<string|int, mixed>
$dirt
= array()
$id
protected
int
$id
$offset
Path of the current array
protected
string
$offset
$parentId
protected
int
$parentId
Methods
__construct()
Default object constructor.
public
__construct(array<string|int, mixed> $data[, string $offset = '' ][, int $parentId = 0 ][, callable $callableOnSet = null ][, callable $callableOnGet = null ][, callable $callableOnUnset = null ][, callable $callableOnValidateKey = null ]) : mixed
Parameters
- $data : array<string|int, mixed>
- $offset : string = ''
- $parentId : int = 0
- $callableOnSet : callable = null
- $callableOnGet : callable = null
- $callableOnUnset : callable = null
- $callableOnValidateKey : callable = null
clean()
Empties the offset with values which were changed.
public
clean(mixed $offset) : mixed
Parameters
- $offset : mixed
count()
Get the count of elements in the container array.
public
count() : int
Tags
Return values
intcurrent()
Current position of the array.
public
current() : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
isDirty()
Checks if a value is dirty.
public
isDirty(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
boolkey()
Key of the current element.
public
key() : mixed
Tags
Attributes
- #[ReturnTypeWillChange]
next()
Move the internal point of the container array to the next item
public
next() : void
Tags
offsetExists()
check a offset exists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
-
An offset to check for.
Tags
Return values
bool —true on success or false on failure.
offsetGet()
Offset to retrieve
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
-
The offset to retrieve.
Tags
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Can return all value types.
offsetSet()
Offset to set
public
offsetSet(mixed $offset, mixed $data[, null $callableOnSet = null ][, null $callableOnGet = null ][, null $callableOnUnset = null ][, null $callableOnValidateKey = null ]) : void
Parameters
- $offset : mixed
-
The offset to assign the value to.
- $data : mixed
-
The value to set.
- $callableOnSet : null = null
- $callableOnGet : null = null
- $callableOnUnset : null = null
- $callableOnValidateKey : null = null
Tags
offsetUnset()
Offset to unset
public
offsetUnset(mixed $offset) : null
Parameters
- $offset : mixed
-
The offset to unset.
Tags
Return values
nullpollute()
Pollutes a value.
public
pollute(mixed $offset) : mixed
Parameters
- $offset : mixed
recursiveOffsetExists()
This function checks if the value of an array-index, which is not on first level of the main array, is set e.g $array['level1']['level2']['level3']
public
recursiveOffsetExists(string $offset[, string $delimiter = '/' ]) : bool
Parameters
- $offset : string
-
string containing the offset e.g 'level1/level2/level3'
- $delimiter : string = '/'
-
the delimiter used in $offset e.g '/'
Tags
Return values
boolrecursiveOffsetGet()
This function returns the value of an array-index which is not on first level of the main array e.g $array['level1']['level2']['level3']
public
recursiveOffsetGet(string $offset[, string $delimiter = '/' ]) : mixed
Parameters
- $offset : string
-
string containing the offset e.g 'level1/level2/level3'
- $delimiter : string = '/'
-
the delimiter used in $offset e.g '/'
Tags
Return values
mixed —value of the array index
recursiveOffsetSet()
This function sets the value of an array-index which is not on first level of the main array e.g $array['level1']['level2']['level3'] If the previous index i.e ['level1'] is not set it will be set to array.
public
recursiveOffsetSet(mixed $value, string $offset[, string $delimiter = '/' ]) : mixed
Note: If it is set but not an array it will be overwritten
Parameters
- $value : mixed
-
the value which should be set
- $offset : string
-
string containing the offset e.g 'level1/level2/level3'
- $delimiter : string = '/'
-
the delimiter used in $offset e.g '/'
Tags
rewind()
Rewind the internal point of the container array.
public
rewind() : void
Tags
toArray()
Output the data as a multidimensional array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>valid()
Is the current key valid?
public
valid() : bool