Documentation

DeepCopy
in package

Tags
final

Table of Contents

$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
__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.

Return values
mixed

copy()

Deep copies the given object.

public copy(mixed $object) : mixed
Parameters
$object : mixed
Return values
mixed

skipUncloneable()

If enabled, will not throw an exception when coming across an uncloneable property.

public skipUncloneable([ $skipUncloneable = true ]) : $this
Parameters
$skipUncloneable : = true
Return values
$this

copyArray()

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
throws
CloneException
Return values
object

copyObjectProperty()

private copyObjectProperty(mixed $object, ReflectionProperty $property) : mixed
Parameters
$object : mixed
$property : ReflectionProperty
Return values
mixed

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|null

recursiveCopy()

private recursiveCopy(mixed $var) : mixed
Parameters
$var : mixed
Return values
mixed

Search results