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.
__destruct()  : mixed
add()  : bool|int|string
Adds a value to the context.
contains()  : false|int|string
Checks if the given value exists within the context.
addArray()  : bool|int
addObject()  : string
containsArray()  : false|int
containsObject()  : false|string

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

__destruct()

public __destruct() : mixed
Tags
codeCoverageIgnore
Return values
mixed

add()

Adds a value to the context.

public add(array<string|int, mixed>|object &$value) : bool|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

psalm-template

T

psalm-param

T $value

param-out

T $value

Return values
bool|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) : false|int|string
Parameters
$value : array<string|int, mixed>|object

the value to check

Tags
throws
InvalidArgumentException

Thrown if $value is not an array or object

psalm-template

T

psalm-param

T $value

param-out

T $value

Return values
false|int|string

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) : false|int
Parameters
$array : array<string|int, mixed>
Return values
false|int

containsObject()

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

Search results