Builder/Generator.php
protected function recursiveReplace($base, $replacement)
    {
        $replace_values_recursive = function (array $array, array $order) use (&$replace_values_recursive) {
            $array = array_replace($order, array_replace($array, $order));

            foreach ($array as $key => &$value) {
                if (is_array($value)) {
                    $value = (array_key_exists($key, $order) && is_array($order[$key]))
                        ? $replace_values_recursive($value, $order[$key])
                        : $value
                    ;
                }
            }
            return $array;
        };

        return $replace_values_recursive($base, $replacement);
    }
protected function recursiveReplace($base, $replacement)
    {
        $replace_values_recursive = function (array $array, array $order) use (&$replace_values_recursive) {
            $array = array_replace($order, array_replace($array, $order));

            foreach ($array as $key => &$value) {
                if (is_array($value)) {
                    $value = (array_key_exists($key, $order) && is_array($order[$key]))
                        ? $replace_values_recursive($value, $order[$key])
                        : $value
                    ;
                }
            }
            return $array;
        };

        return $replace_values_recursive($base, $replacement);
    }
protected function recursiveReplace ( $ base , $ replacement ) { $ replace_values_recursive = function ( array $ array , array $ order ) use ( & $ replace_values_recursive ) { $ array = array_replace ( $ order , array_replace ( $ array , $ order ) ) ; foreach ( $ array as $ key => & $ value ) { if ( is_array ( $ value ) ) { $ value = ( array_key_exists ( $ key , $ order ) && is_array ( $ order [ $ key ] ) ) ? $ replace_values_recursive ( $ value , $ order [ $ key ] ) : $ value ; } } return $ array ; } ; return $ replace_values_recursive ( $ base , $ replacement ) ; }
Recursively replaces Base array values with Replacement array values
while keeping indexes of Replacement array

@param array $base Base array
@param array $replacement Replacement array
Recursively replaces Base array values with Replacement array values while keeping indexes of Replacement array