Documentation

Context
in package

A context containing previously processed arrays and objects when recursively processing a value.

Table of Contents

$arrays  : array<string|int, array<string|int, mixed>>
$objects  : SplObjectStorage
__construct()  : mixed
Initialises the context
add()  : int|string
Adds a value to the context.
contains()  : int|string|false
Checks if the given value exists within the context.
addArray()  : bool|int
addObject()  : string
containsArray()  : int|false
containsObject()  : string|false

Properties

$arrays

private array<string|int, array<string|int, mixed>> $arrays

$objects

private SplObjectStorage $objects

Methods

__construct()

Initialises the context

public __construct() : mixed
Return values
mixed

add()

Adds a value to the context.

public add(array<string|int, mixed>|object &$value) : int|string
Parameters
$value : array<string|int, mixed>|object

The value to add.

Tags
throws
InvalidArgumentException

Thrown if $value is not an array or object

Return values
int|string

The ID of the stored value, either as a string or integer.

contains()

Checks if the given value exists within the context.

public contains(array<string|int, mixed>|object &$value) : int|string|false
Parameters
$value : array<string|int, mixed>|object

The value to check.

Tags
throws
InvalidArgumentException

Thrown if $value is not an array or object

Return values
int|string|false

The string or integer ID of the stored value if it has already been seen, or false if the value is not stored.

addArray()

private addArray(array<string|int, mixed> &$array) : bool|int
Parameters
$array : array<string|int, mixed>
Return values
bool|int

addObject()

private addObject(object $object) : string
Parameters
$object : object
Return values
string

containsArray()

private containsArray(array<string|int, mixed> &$array) : int|false
Parameters
$array : array<string|int, mixed>
Return values
int|false

containsObject()

private containsObject(object $value) : string|false
Parameters
$value : object
Return values
string|false

Search results