\Symfony\Component\VarDumper\ClonerAbstractCloner

AbstractCloner implements a generic caster mechanism for objects and resources.

Summary

Methods
Properties
Constants
__construct()
addCasters()
setMaxItems()
setMaxString()
cloneVar()
$defaultCasters
No constants found
doClone()
castObject()
castResource()
$maxItems
$maxString
$useExt
N/A
callCaster()
$casters
$prevErrorHandler
$classInfo
N/A

Properties

$defaultCasters

$defaultCasters : 

Type

$maxItems

$maxItems : 

Type

$maxString

$maxString : 

Type

$useExt

$useExt : 

Type

$casters

$casters : 

Type

$prevErrorHandler

$prevErrorHandler : 

Type

$classInfo

$classInfo : 

Type

Methods

__construct()

__construct(array<mixed,callable>|null  $casters = null) 

Parameters

array<mixed,callable>|null $casters

A map of casters.

addCasters()

addCasters(array<mixed,callable>  $casters) 

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

array<mixed,callable> $casters

A map of casters.

setMaxItems()

setMaxItems(integer  $maxItems) 

Sets the maximum number of items to clone past the first level in nested structures.

Parameters

integer $maxItems

setMaxString()

setMaxString(integer  $maxString) 

Sets the maximum cloned length for strings.

Parameters

integer $maxString

cloneVar()

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

Clones a PHP variable.

Parameters

mixed $var

Any PHP variable.

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, boolean  $isNested) : array

Casts an object to an array representation.

Parameters

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

The Stub for the casted object.

boolean $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, boolean  $isNested) : array

Casts a resource to an array representation.

Parameters

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

The Stub for the casted resource.

boolean $isNested

True if the object is nested in the dumped structure.

Returns

array —

The resource casted as array.

callCaster()

callCaster(callable  $callback, object|resource  $obj, array  $a, \Symfony\Component\VarDumper\Cloner\Stub  $stub, boolean  $isNested) : array

Calls a custom caster.

Parameters

callable $callback

The caster.

object|resource $obj

The object/resource being casted.

array $a

The result of the previous cast for chained casters.

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

The Stub for the casted object/resource.

boolean $isNested

True if $obj is nested in the dumped structure.

Returns

array —

The casted object/resource.