class VarCloner extends AbstractCloner

Properties

static $defaultCasters from AbstractCloner
protected $maxItems from AbstractCloner
protected $maxString from AbstractCloner
protected $useExt from AbstractCloner

Methods

__construct(array $casters = null)

No description

addCasters(array $casters)

Adds casters for resources and objects.

setMaxItems(int $maxItems)

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

setMaxString(int $maxString)

Sets the maximum cloned length for strings.

cloneVar(mixed $var, int $filter = 0)

Clones a PHP variable.

array
doClone(mixed $var)

Effectively clones the PHP variable.

array
castObject(Stub $stub, bool $isNested)

Casts an object to an array representation.

array
castResource(Stub $stub, bool $isNested)

Casts a resource to an array representation.

handleError($type, $msg, $file, $line, $context)

Special handling for errors: cloning must be fail-safe.

Details

in AbstractCloner at line 134
__construct(array $casters = null)

Parameters

array $casters A map of casters

See also

addCasters

in AbstractCloner at line 153
addCasters(array $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 $casters A map of casters

in AbstractCloner at line 165
setMaxItems(int $maxItems)

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

Parameters

int $maxItems

in AbstractCloner at line 175
setMaxString(int $maxString)

Sets the maximum cloned length for strings.

Parameters

int $maxString

in AbstractCloner at line 188
Data cloneVar(mixed $var, int $filter = 0)

Clones a PHP variable.

Parameters

mixed $var Any PHP variable
int $filter A bit field of Caster::EXCLUDE_* constants

Return Value

Data The cloned variable represented by a Data object

at line 25
protected array doClone(mixed $var)

Effectively clones the PHP variable.

Parameters

mixed $var Any PHP variable

Return Value

array The cloned variable represented in an array

in AbstractCloner at line 223
protected array castObject(Stub $stub, bool $isNested)

Casts an object to an array representation.

Parameters

Stub $stub The Stub for the casted object
bool $isNested True if the object is nested in the dumped structure

Return Value

array The object casted as array

in AbstractCloner at line 263
protected array castResource(Stub $stub, bool $isNested)

Casts a resource to an array representation.

Parameters

Stub $stub The Stub for the casted resource
bool $isNested True if the object is nested in the dumped structure

Return Value

array The resource casted as array

in AbstractCloner at line 309
handleError($type, $msg, $file, $line, $context)

Special handling for errors: cloning must be fail-safe.

Parameters

$type
$msg
$file
$line
$context