Merge the given prefs over the current config
and make sure that they survive further merging.

@param array $prefs Hash array with user prefs
965603
public function set_user_prefs($prefs)
    {
        $prefs = $this->fix_legacy_props($prefs);

        // Honor the dont_override setting for any existing user preferences
        $dont_override = $this->get('dont_override');
        if (is_array($dont_override) && !empty($dont_override)) {
            foreach ($dont_override as $key) {
                unset($prefs[$key]);
            }
        }

        // larry is the new default skin :-)
        if ($prefs['skin'] == 'default') {
            $prefs['skin'] = self::DEFAULT_SKIN;
        }

        $this->userprefs = $prefs;
        $this->prop      = array_merge($this->prop, $prefs);
    }
27682
protected function mergeNewFlashes(array $keys)
        {
            $values = array_unique(array_merge($this->session->getValue($this->key_name.'.new'), $keys));
            $this->session->setValue($this->key_name.'.new', $values);
        }
1216475
protected function mergeModuleConfig(string $key, array $config)
    {
        if (!empty($config)) {
            $current = $this->app['config']->get($key);
            if (is_array($current)) {
                $this->app['config']->set($key, array_merge($current, $config));
            } else {
                $this->app['config']->set($key, $config);
            }
        }
    }
152030
protected function mergeNewFlashes( array $keys )
	{
		$values = array_unique( array_merge( $this->get( 'flash.new', [] ), $keys ) );

		$this->put( 'flash.new', $values );
	}
323981
protected function mergeConfigs(array $configs)
    {
        $mergedConfig = array();
        
        foreach($configs as $config)
        {
            $mergedConfig = array_merge_recursive($mergedConfig, $config);
        }
        
        return  array($mergedConfig);
    }
569519
public function putErrors($errors) {
        if (!is_array($errors) && !($errors instanceof MessageProvider)) {
            $errors = [$errors];
        }
        $this->errors->merge($errors);
    }
882130
private function mergeConfigs($key)
    {
        $mergedConfig = [];
        $userConfig = key($this->configs);
        foreach ($this->configs as $config) {
            $mergedConfig = array_merge(isset($config[$key]) ? $config[$key] : [], $mergedConfig);
        }
        $this->configs[$userConfig][$key] = $mergedConfig;
    }
8415
protected function synchronizeIncludes(array $includes): void
	{
		foreach($includes as $include) {
			$rowToAdd = $this->createRow($include);
			Helpers::appendToFile($this->configurationFile, $rowToAdd);
		}
	}
156232
protected function mergeConfigs(array $configs)
    {
        $merged = array();
        foreach ($configs as $config) {
            $merged = array_merge($merged, $config);
        }

        return $merged;
    }
928383
function mergeKeys( &$originalKeys, $keys )
    {
        foreach ( $keys as $key )
        {
            if ( count( $key ) >= 2 )
                $originalKeys[$key[0]] = $key[1];
        }
    }
122853
protected function mergeConfigWithDefaults($preset)
    {
        // Get the preset settings
        if (!$settings = Config::get('decoy.encode.presets.'.$preset.'.settings')) {
            throw new Exception('Encoding preset not found: '.$preset);
        }

        // If the settings are an assoc array, then there is only one output and it
        // needs to be wrapped in an array
        if (!is_numeric(array_keys($settings)[0])) {
            $settings = ['mp4' => $settings];
        }

        // Merge defaults with each output in the settings
        return array_map(function ($output) {
            return array_merge($this->defaults, $output);
        }, $settings);
    }
1325511
public function addItems(array $items, $append = true)
    {
        $this->_items = $this->mergeItems($this->_items, $items, $append);
    }
1177399
public function setConfig(array $config, $overwrite = false)
    {
        if ($overwrite) {
            $this->config = $this->mergeConfig($this->config, $config);
        } else {
            $this->config = $this->mergeConfig($config, $this->config);
        }
    }
31540
public function mergeConfigs(array $lowPriorityConfig, array $highPriorityConfig)
    {
        foreach ($highPriorityConfig as $key => $value) {
            if ($highPriorityConfig[$key] !== '') {
                $lowPriorityConfig[$key] = $highPriorityConfig[$key];
            }
        }
        return $lowPriorityConfig;
    }
25175
private function mergeConfigs(array $first, array $second)
    {
        foreach ($second as $name => $value) {
            if (0 === strpos($name, 'override~')) {
                $name = preg_replace('/^override~/', '', $name);

                if (!array_key_exists($name, $first)) {
                    $this->logger->warning(sprintf('Unable to find parameter "%s" for overriding.', $name));

                    continue;
                }
                if (!is_array($first[$name])) {
                    throw new ConfigurationException(
                        sprintf('Unable to override parameter "%s": only array parameters can be overridden.', $name)
                    );
                }

                $first[$name] = $second['override~'.$name];

                continue;
            }
            if (0 === strpos($name, 'remove~')) {
                $name = preg_replace('/^remove~/', '', $name);

                if (!array_key_exists($name, $first)) {
                    $this->logger->warning(sprintf('Unable to find parameter "%s" for removal.', $name));

                    continue;
                }

                unset($first[$name]);

                continue;
            }

            preg_match('/^(after|before)~(.*)~(.*)$/', $name, $matches);

            if (4 === count($matches)) {
                list(, $position, $target, $name) = $matches;

                if (!array_key_exists($target, $first)) {
                    $this->logger->warning(sprintf('Unable to find parameter "%s" to place %s it.', $target, $position));

                    $first[$name] = $value;

                    continue;
                }

                $replacement = [];

                foreach ($first as $n => $v) {
                    if ('before' === $position && $n === $target) {
                        $replacement[$name] = $value;
                    }

                    $replacement[$n] = $v;

                    if ('after' === $position && $n === $target) {
                        $replacement[$name] = $value;
                    }
                }

                $first = $replacement;

                continue;
            }
            if (!array_key_exists($name, $first)) {
                $first[$name] = $value;

                continue;
            }
            if (!is_array($first[$name]) || !is_array($second[$name])) {
                $first[$name] = $second[$name];

                continue;
            }
            if ($this->isIndexed($first[$name]) && $this->isIndexed($second[$name])) {
                $first[$name] = array_merge($first[$name], $second[$name]);

                continue;
            }

            $first[$name] = $this->mergeConfigs($first[$name], $second[$name]);
        }

        return $first;
    }
641873
public function setMerged(array $files)
    {
        if (!empty($files)) {
            foreach ($files as $_file) {
                if (is_array($_file) && isset($_file['file'])) {
                    if (isset($_file['media'])) {
                        $this->add($_file['file'], $_file['media']);
                    } else {
                        $this->add($_file['file']);
                    }
                } elseif (is_string($_file)) {
                    $this->add($_file);
                }
            }
        }
        return $this;
    }
80034
protected function mergeHeader(array $keys)
    {
        foreach ($keys as $key) {
            if (!isset($this->header[$key])) {
                $this->header[$key] = '';
            }
        }
    }