Trait MergeVariablesTrait
Provides features for merging object properties recursively with parent classes.
Method Summary
-
_mergeProperty() protected
Merge a single property with the values declared in all parent classes.
-
_mergePropertyData() protected
Merge each of the keys in a property together.
-
_mergeVars() protected
Merge the list of $properties with all parent classes of the current class.
Method Detail
_mergeProperty() ¶ protected
_mergeProperty(string $property, array $parentClasses, array $options): void
Merge a single property with the values declared in all parent classes.
Parameters
-
string
$property The name of the property being merged.
-
array
$parentClasses An array of classes you want to merge with.
-
array
$options Options for merging the property, see _mergeVars()
Returns
void
_mergePropertyData() ¶ protected
_mergePropertyData(array $current, array $parent, bool $isAssoc): mixed
Merge each of the keys in a property together.
Parameters
-
array
$current The current merged value.
-
array
$parent The parent class' value.
-
bool
$isAssoc Whether or not the merging should be done in associative mode.
Returns
mixed
_mergeVars() ¶ protected
_mergeVars(string[] $properties, array $options = []): void
Merge the list of $properties with all parent classes of the current class.
Options:
associative
- A list of properties that should be treated as associative arrays. Properties in this list will be passed through Hash::normalize() before merging.
Parameters
-
string[]
$properties An array of properties and the merge strategy for them.
-
array
$options optional The options to use when merging properties.
Returns
void