src/Control/Session.php
protected function recursivelyApplyChanges($changes, $source, &$destination)
    {
        $source = $source ?: [];
        foreach ($changes as $key => $changed) {
            if ($changed === true) {
                // Determine if replacement or removal
                if (array_key_exists($key, $source)) {
                    $destination[$key] = $source[$key];
                } else {
                    unset($destination[$key]);
                }
            } else {
                // Recursively apply
                $destVal = &$this->nestedValueRef($key, $destination);
                $sourceVal = $this->nestedValue($key, $source);
                $this->recursivelyApplyChanges($changed, $sourceVal, $destVal);
            }
        }
    }
protected function recursivelyApplyChanges($changes, $source, &$destination)
    {
        $source = $source ?: [];
        foreach ($changes as $key => $changed) {
            if ($changed === true) {
                // Determine if replacement or removal
                if (array_key_exists($key, $source)) {
                    $destination[$key] = $source[$key];
                } else {
                    unset($destination[$key]);
                }
            } else {
                // Recursively apply
                $destVal = &$this->nestedValueRef($key, $destination);
                $sourceVal = $this->nestedValue($key, $source);
                $this->recursivelyApplyChanges($changed, $sourceVal, $destVal);
            }
        }
    }
protected function recursivelyApplyChanges ( $ changes , $ source , & $ destination ) { $ source = $ source ? : [ ] ; foreach ( $ changes as $ key => $ changed ) { if ( $ changed === true ) { // Determine if replacement or removal if ( array_key_exists ( $ key , $ source ) ) { $ destination [ $ key ] = $ source [ $ key ] ; } else { unset ( $ destination [ $ key ] ) ; } } else { // Recursively apply $ destVal = & $ this -> nestedValueRef ( $ key , $ destination ) ; $ sourceVal = $ this -> nestedValue ( $ key , $ source ) ; $ this -> recursivelyApplyChanges ( $ changed , $ sourceVal , $ destVal ) ; } } }
Apply all changes using separate keys and data sources and a destination

@internal
@param array $changes
@param array $source
@param array $destination
Apply all changes using separate keys and data sources and a destination