\Symfony\Component\VarDumper\ClonerAbstractCloner

AbstractCloner implements a generic caster mechanism for objects and resources.

Summary

Methods
Properties
Constants
__construct()
addCasters()
setMaxItems()
setMaxString()
setMinDepth()
cloneVar()
$defaultCasters
No constants found
doClone()
castObject()
castResource()
$maxItems
$maxString
$minDepth
N/A
No private methods found
$casters
$prevErrorHandler
$classInfo
$filter
N/A

Properties

$defaultCasters

$defaultCasters

$maxItems

$maxItems

$maxString

$maxString

$minDepth

$minDepth

$casters

$casters

$prevErrorHandler

$prevErrorHandler

$classInfo

$classInfo

$filter

$filter

Methods

__construct()

__construct(callable[]|null  $casters = null) : mixed

Parameters

callable[]|null $casters

A map of casters

Returns

mixed —

addCasters()

addCasters(callable[]  $casters) : mixed

Adds casters for resources and objects.

Maps resources or objects types to a callback. Types are in the key, with a callable caster for value. Resource types are to be prefixed with a :, see e.g. static::$defaultCasters.

Parameters

callable[] $casters

A map of casters

Returns

mixed —

setMaxItems()

setMaxItems(int  $maxItems) : mixed

Sets the maximum number of items to clone past the minimum depth in nested structures.

Parameters

int $maxItems

Returns

mixed —

setMaxString()

setMaxString(int  $maxString) : mixed

Sets the maximum cloned length for strings.

Parameters

int $maxString

Returns

mixed —

setMinDepth()

setMinDepth(int  $minDepth) : mixed

Sets the minimum tree depth where we are guaranteed to clone all the items. After this depth is reached, only setMaxItems items will be cloned.

Parameters

int $minDepth

Returns

mixed —

cloneVar()

cloneVar(mixed  $var, int  $filter) : \Symfony\Component\VarDumper\Cloner\Data

Clones a PHP variable.

Parameters

mixed $var

Any PHP variable

int $filter

A bit field of Caster::EXCLUDE_* constants

Returns

\Symfony\Component\VarDumper\Cloner\Data —

The cloned variable represented by a Data object

doClone()

doClone(mixed  $var) : array

Effectively clones the PHP variable.

Parameters

mixed $var

Any PHP variable

Returns

array —

The cloned variable represented in an array

castObject()

castObject(\Symfony\Component\VarDumper\Cloner\Stub  $stub, bool  $isNested) : array

Casts an object to an array representation.

Parameters

\Symfony\Component\VarDumper\Cloner\Stub $stub
bool $isNested

True if the object is nested in the dumped structure

Returns

array —

The object casted as array

castResource()

castResource(\Symfony\Component\VarDumper\Cloner\Stub  $stub, bool  $isNested) : array

Casts a resource to an array representation.

Parameters

\Symfony\Component\VarDumper\Cloner\Stub $stub
bool $isNested

True if the object is nested in the dumped structure

Returns

array —

The resource casted as array