DeepCopy
in package
Tags
Table of Contents
Properties
- $filters : array<string|int, mixed>
- Filters to apply.
- $hashMap : array<string|int, object>
- $skipUncloneable : bool
- $typeFilters : array<string|int, mixed>
- Type Filters to apply.
- $useCloneMethod : bool
Methods
- __construct() : mixed
- addFilter() : mixed
- addTypeFilter() : mixed
- copy() : mixed
- Deep copies the given object.
- prependFilter() : mixed
- skipUncloneable() : $this
- If enabled, will not throw an exception when coming across an uncloneable property.
- copyArray() : array<string|int, mixed>
- Copy an array
- copyObject() : object
- Copies an object.
- copyObjectProperty() : mixed
- first() : array<string|int, mixed>|null
- Returns first element that matches predicate, `null` if no such element found.
- getFirstMatchedTypeFilter() : TypeFilter|null
- Returns first filter that matches variable, `null` if no such filter found.
- recursiveCopy() : mixed
Properties
$filters
Filters to apply.
private
array<string|int, mixed>
$filters
= []
Array of ['filter' => Filter, 'matcher' => Matcher] pairs.
$hashMap
private
array<string|int, object>
$hashMap
= []
List of objects copied.
$skipUncloneable
private
bool
$skipUncloneable
= false
$typeFilters
Type Filters to apply.
private
array<string|int, mixed>
$typeFilters
= []
Array of ['filter' => Filter, 'matcher' => Matcher] pairs.
$useCloneMethod
private
bool
$useCloneMethod
Methods
__construct()
public
__construct([bool $useCloneMethod = false ]) : mixed
Parameters
- $useCloneMethod : bool = false
-
If set to true, when an object implements the __clone() function, it will be used instead of the regular deep cloning.
addFilter()
public
addFilter(Filter $filter, Matcher $matcher) : mixed
Parameters
addTypeFilter()
public
addTypeFilter(TypeFilter $filter, TypeMatcher $matcher) : mixed
Parameters
- $filter : TypeFilter
- $matcher : TypeMatcher
copy()
Deep copies the given object.
public
copy(mixed $object) : mixed
Parameters
- $object : mixed
prependFilter()
public
prependFilter(Filter $filter, Matcher $matcher) : mixed
Parameters
skipUncloneable()
If enabled, will not throw an exception when coming across an uncloneable property.
public
skipUncloneable([mixed $skipUncloneable = true ]) : $this
Parameters
- $skipUncloneable : mixed = true
Return values
$thiscopyArray()
Copy an array
private
copyArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
Return values
array<string|int, mixed>copyObject()
Copies an object.
private
copyObject(object $object) : object
Parameters
- $object : object
Tags
Return values
objectcopyObjectProperty()
private
copyObjectProperty(mixed $object, ReflectionProperty $property) : mixed
Parameters
- $object : mixed
- $property : ReflectionProperty
first()
Returns first element that matches predicate, `null` if no such element found.
private
first(array<string|int, mixed> $elements, callable $predicate) : array<string|int, mixed>|null
Parameters
- $elements : array<string|int, mixed>
-
Array of ['filter' => Filter, 'matcher' => Matcher] pairs.
- $predicate : callable
-
Predicate arguments are: element.
Return values
array<string|int, mixed>|null —Associative array with 2 members: 'filter' with value of type TypeFilter and 'matcher'
with value of type TypeMatcher or null
.
getFirstMatchedTypeFilter()
Returns first filter that matches variable, `null` if no such filter found.
private
getFirstMatchedTypeFilter(array<string|int, mixed> $filterRecords, mixed $var) : TypeFilter|null
Parameters
- $filterRecords : array<string|int, mixed>
-
Associative array with 2 members: 'filter' with value of type TypeFilter and 'matcher' with value of type TypeMatcher
- $var : mixed
Return values
TypeFilter|nullrecursiveCopy()
private
recursiveCopy(mixed $var) : mixed
Parameters
- $var : mixed