\phpDocumentor\ConfigurationMerger

Deep-merges any variable.

This class is capable of merging together arrays and objects of the same class; all other types of variables are replaced. In addition this merger also supports the Replace annotation; this annotation can be placed on a property of a class and will indicate that that property must not be merged but replaced in its entirety.

Summary

Methods
Properties
Constants
__construct()
run()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
mergeObject()
mergeArray()
mergeProperty()
shouldPropertyBeReplaced()
$reader
N/A

Properties

$reader

$reader : \Doctrine\Common\Annotations\AnnotationReader

Type

\Doctrine\Common\Annotations\AnnotationReader — Object used to fetch all annotations for structural elements in a given piece of code

Methods

__construct()

__construct(\Doctrine\Common\Annotations\AnnotationReader  $reader) 

Initializes this merger with the annotation reader.

Parameters

\Doctrine\Common\Annotations\AnnotationReader $reader

run()

run(mixed  $destination, mixed  $source, mixed  $default = null) : mixed

Merges the source on top of the destination and returns the result.

Parameters

mixed $destination

The destination variable that will be overwritten with the data from the source.

mixed $source

The source variable that should be merged over the destination.

mixed $default

For normal variables; only replace that variable if the provided source does not equal this value.

Returns

mixed —

the merged variable.

mergeObject()

mergeObject(object  $destinationObject, object  $sourceObject) : object

Deep-merge the source object over the destination object and return the results.

Parameters

object $destinationObject
object $sourceObject

Returns

object

mergeArray()

mergeArray(array  $destinationArray, array  $sourceArray) : array

Deep-merges the source array over the destination array.

Parameters

array $destinationArray
array $sourceArray

Returns

array

mergeProperty()

mergeProperty(object  $destinationObject, \ReflectionProperty  $destinationProperty, object  $sourceObject, \ReflectionProperty  $sourceProperty, array<mixed,mixed>  $defaultPropertyValues) : object

Merges the two properties over eachother.

Parameters

object $destinationObject
\ReflectionProperty $destinationProperty
object $sourceObject
\ReflectionProperty $sourceProperty
array<mixed,mixed> $defaultPropertyValues

Returns

object

shouldPropertyBeReplaced()

shouldPropertyBeReplaced(\ReflectionProperty  $destinationProperty) : boolean

Tests whether the value of the property should be replaced instead of merged by checking if it has the `Replace` annotation.

Parameters

\ReflectionProperty $destinationProperty

Returns

boolean