lithium\core\MergeInheritable::_inherit()

protected method

Recursively merges a set of properties of each parent in the class tree into the objects corresponding property.

When called from a subclass will stop after merging that class' properties this method is member of.

Note: Will error out when trying to merge a non-array property.

Parameters

  • array $properites

    Names of array properties to merge with.

Returns

void

Source

	protected function _inherit(array $properties) {
		if (($class = get_called_class()) === __CLASS__) {
			return;
		}
		foreach (class_parents($class) as $parent) {
			$inherit = get_class_vars($parent);

			foreach ($properties as $member) {
				if (isset($inherit[$member])) {
					$this->{$member} += $inherit[$member];
				}
			}
			if ($parent === __CLASS__) {
				break;
			}
		}
	}