Merges configurations. Left has higher priority than right one.

@return array|string
977407
public static function merge($left, $right)
	{
		if (is_array($left) && is_array($right)) {
			foreach ($left as $key => $val) {
				if (is_int($key)) {
					$right[] = $val;
				} else {
					if (isset($right[$key])) {
						$val = static::merge($val, $right[$key]);
					}
					$right[$key] = $val;
				}
			}

			return $right;

		} elseif ($left === NULL && is_array($right)) {
			return $right;

		} else {
			return $left;
		}
	}
907926
public function merge(Zend_Config $merge)
    {
        foreach($merge as $key => $item) {
            if(array_key_exists($key, $this->_data)) {
                if($item instanceof Zend_Config && $this->$key instanceof Zend_Config) {
                    $this->$key = $this->$key->merge(new Zend_Config($item->toArray(), !$this->readOnly()));
                } else {
                    $this->$key = $item;
                }
            } else {
                if($item instanceof Zend_Config) {
                    $this->$key = new Zend_Config($item->toArray(), !$this->readOnly());
                } else {
                    $this->$key = $item;
                }
            }
        }

        return $this;
    }
1294733
public function pushElevateConfiguration()
    {
        if ( $this->UseMultiLanguageCores == true )
        {
            foreach ( $this->SolrLanguageShards as $shard )
            {
                eZFindElevateConfiguration::synchronizeWithSolr( $shard );
            }
            return true;
        }
        else
        {
            return eZFindElevateConfiguration::synchronizeWithSolr( $this->Solr );
        }

    }
1255349
protected function getMergedProperties() {
        $parentProperties = $this->parent ? $this->parent->getMergedProperties() : [];
        return \array_merge($parentProperties, $this->properties);
    }
1089372
protected function mergeOptions($options)
    {
        $config = Configuration::config();
        $baseOptions = array_merge($this->options, $config['settings']);
        return array_merge($baseOptions, $options);
    }
206485
public function mergeWithCombine($left, $right)
    {
        if (is_array($left) && is_array($right)) {
            foreach ($left as $key => $val) {
                if (is_int($key)) {
                    $right[] = $val;
                } else {
                    if (isset($right[$key])) {
                        $val = $this->mergeWithCombine($val, $right[$key]);
                    }
                    $right[$key] = $val;
                }
            }
            return $right;
        } elseif ($left === null && is_array($right)) {
            return $right;
        }

        if (! empty($right) && (array) $left !== (array) $right) {
            return $this->mergeWithCombine((array) $right, (array) $left);
        }

        return $left;
    }
782140
public function getConfigFilesSorted()
    {
        $fileSystem = new Filesystem();

        $projectConfig = $fileSystem->glob(app_path('hc-config.json'));
        $packageConfigs = $fileSystem->glob(__DIR__ . '/../../../../*/*/*/hc-config.json');

        $packageConfigs = $this->sortByPriority($packageConfigs);

        $files = array_merge($packageConfigs, $projectConfig);

        return $files;
    }
1291353
public function mergeConfig($resources)
    {
        $configs = array();
        foreach (is_array($resources) ? $resources : func_get_args() as $resource) {
            $configs = ArrayUtils::merge($configs, $this->loadConfig($resource));
        }

        return $configs;
    }
164063
private function getOrganizeMigrationsModes() : array
    {
        $constPrefix = 'VERSIONS_ORGANIZATION_';
        $prefixLen   = strlen($constPrefix);
        $refClass    = new ReflectionClass('Doctrine\Migrations\Configuration\Configuration');
        $constsArray = $refClass->getConstants();
        $namesArray  = [];

        foreach ($constsArray as $key => $value) {
            if (strpos($key, $constPrefix) !== 0) {
                continue;
            }

            $namesArray[] = substr($key, $prefixLen);
        }

        return $namesArray;
    }
63066
protected function _merge( array $left, array $right )
	{
		foreach( $right as $key => $value )
		{
			if( isset( $left[$key] ) && is_array( $left[$key] ) && is_array( $value ) ) {
				$left[$key] = $this->_merge( $left[$key], $value );
			} else {
				$left[$key] = $value;
			}
		}

		return $left;
	}
409935
private function getCLIConfigs()
    {
        $command = '';
        $combinedConfigs = array_merge($this->globalConfigs, $this->configs);
        if (count($combinedConfigs)) {
            foreach ($combinedConfigs as $config => $value) {
                $command .= sprintf(
                    ' %s %s=%s',
                    escapeshellarg('-c'),
                    escapeshellarg($config),
                    escapeshellarg($value)
                );
            }
        }
        return $command;
    }
232484
protected function mergePackageConfiguration()
    {
        $defaultConfig = require self::CONFIG_PATH;
        $currentConfig = $this->config->get('redis-sentinel', [ ]);

        $this->packageConfig = array_merge($defaultConfig, $currentConfig);
    }
382162
protected function getConfig()
    {
        if ($this->config !== null) {
            return $this->config;
        }

        $config = $this->merge(
            $this->defaultConfig,
            getValue($this->namespace, $this->composerJson)
        );

        if ($this->presetsPath === null || $config === null) {
            return $this->config = $config;
        }

        $presets = $this->loadPresets(getValue($this->presetsPath, $config, []));
        $presetsConfig = array_reduce($presets, $this->merge, array_shift($presets));

        return $this->config = $this->merge($presetsConfig, $config);
    }
655110
public function merge()
    {
        $cleaned_stack = $this->cleanStack($this->get(), 'path');
        if (!empty($cleaned_stack)) {
            $this->addMerged(
                $this->mergeStack($this->extractFromStack($cleaned_stack, 'path'))
            );
        }
        return $this;
    }
265008
public static function merge()
	{
		$result = array();
		$args = func_get_args();
		foreach ($args as &$array) {
			if ($array instanceof \Traversable) {
				foreach ($array as $key => $value) {
					$result[$key] = $value;
				}
			}
		}
		return $result;
	}
1325665
public function merge()
    {
        $array = $this->getResult();
        foreach ($array as $key => $value) {
            $value['name'] = $value['0'];
            $value['type'] = $value['1'];
            $value['key'] = $value['0'].' :';
            $value['value'] = '';
            unset($value['1']);
            unset($value['0']);
            $this->result[] = $value;
        }

        return $this->result;
    }
1359200
public static function mergeConfig(): array
    {
        $args = \func_get_args();
        $res = array_shift($args) ?: [];
        foreach ($args as $items) {
            if (!\is_array($items)) {
                continue;
            }
            foreach ($items as $k => $v) {
                if ($v instanceof \yii\helpers\UnsetArrayValue || $v instanceof \Yiisoft\Arrays\UnsetArrayValue) {
                    unset($res[$k]);
                } elseif ($v instanceof \yii\helpers\ReplaceArrayValue || $v instanceof \Yiisoft\Arrays\ReplaceArrayValue) {
                    $res[$k] = $v->value;
                } elseif (\is_int($k)) {
                    /// XXX skip repeated values
                    if (\in_array($v, $res, true))  {
                        continue;
                    }
                    if (isset($res[$k])) {
                        $res[] = $v;
                    } else {
                        $res[$k] = $v;
                    }
                } elseif (\is_array($v) && isset($res[$k]) && \is_array($res[$k])) {
                    $res[$k] = self::mergeConfig($res[$k], $v);
                } else {
                    $res[$k] = $v;
                }
            }
        }

        return $res;
    }