AbstractCloner
abstract class AbstractCloner implements ClonerInterface
AbstractCloner implements a generic caster mechanism for objects and resources.
Properties
static | $defaultCasters | ||
protected | $maxItems | ||
protected | $maxString | ||
protected | $minDepth |
Methods
No description
Adds casters for resources and objects.
Sets the maximum number of items to clone past the minimum depth in nested structures.
Sets the maximum cloned length for strings.
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.
Effectively clones the PHP variable.
Details
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.
setMaxItems(int $maxItems)
Sets the maximum number of items to clone past the minimum depth in nested structures.
setMinDepth(int $minDepth)
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.
protected array
castResource(Stub $stub, bool $isNested)
Casts a resource to an array representation.