Merge another Config object into this one.

@param Config $config   Instance of Config
@param bool   $override Whether or not to override existing options with
values from the merged config object

@return self This Config object
547425
public function merge(self $config, $override = true)
    {
        if ($override) {
            $this->config = array_replace_recursive($this->config, $config->toArray());
        } else {
            $this->config = array_replace_recursive($config->toArray(), $this->config);
        }

        return $this;
    }
56889
public function merge($config)
    {
        // override defaults with given config
        if (!empty($config['config']) && is_array($config['config'])) {
            foreach ($config['config'] as $key => $val) {
                if (in_array($key, array('github-oauth', 'http-basic')) && isset($this->config[$key])) {
                    $this->config[$key] = array_merge($this->config[$key], $val);
                } else {
                    $this->config[$key] = $val;
                }
            }
        }

        if (!empty($config['repositories']) && is_array($config['repositories'])) {
            $this->repositories = array_reverse($this->repositories, true);
            $newRepos = array_reverse($config['repositories'], true);
            foreach ($newRepos as $name => $repository) {
                // disable a repository by name
                if (false === $repository) {
                    unset($this->repositories[$name]);
                    continue;
                }

                // disable a repository with an anonymous {"name": false} repo
                if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
                    unset($this->repositories[key($repository)]);
                    continue;
                }

                // store repo
                if (is_int($name)) {
                    $this->repositories[] = $repository;
                } else {
                    $this->repositories[$name] = $repository;
                }
            }
            $this->repositories = array_reverse($this->repositories, true);
        }
    }
409086
public function set($key, $value = null, $override = false)
    {
        // if key is array,
        // loop the set, while expecting value parameter to be override
        if(is_array($key))
        {
            $override = $value;

            foreach($key as $k => $val)
            {
                if($override === true)
                    $this->setOverride($k, $val);
                else
                    $this->data[$k] = $val;
            }

            return $this;
        }
        else
        {
            if($override === true)
                $this->setOverride($key, $value);
            else
                $this->data[$key] = $value;

            return $this;
        }
    }
5271
function configure($config = []) {
    $this->config = array_replace_recursive($this->config, $this->modes[@$config['mode'] ?: $this->config['mode']]);
    
    $this->config = array_replace_recursive($this->config, $config);
    
    return $this;
  }
631868
protected static function modifyConfig($name, array $config, $override = false)
    {
        self::validateAgentName($name);
        if (!isset(self::$agentsConfig[$name])) {
            self::$agentsConfig[$name] = [];
        }
        $target = &self::$agentsConfig[$name];
        if ($override) {
            $target = $config;
        } else {
            $target = array_merge($target, $config);
        }
        if (self::hasAgent($name)) {
            self::getAgent($name)->config($target);
        }
    }
2447
public function setConfig($config)
    {
        $configObject = $this->getConfig();

        if (is_object($config)) {
            $config = get_object_vars($config);
        }

        foreach ((array)$config as $key => $value) {
            $configObject->$key = $value;
        }

        return $this;
    }
14014
public function mergeConfig($configA, $configB)
    {
        $configA = $this->makeConfig($configA);

        $configB = $this->makeConfig($configB);

        return (object) array_merge((array) $configA, (array) $configB);
    }
304417
private function mergeConfigParams(array $config)
    {
        foreach ($config as $name => $value) {
            preg_match('/^extend~(.*)~(.*)$/', $name, $matches);

            if (3 === count($matches)) {
                if (!isset($config[$matches[1]])) {
                    throw new ConfigurationException(sprintf('Unable to find parameter "%s" for extending.', $matches[1]));
                }
                if (!is_array($config[$matches[1]])) {
                    throw new ConfigurationException(
                        sprintf('Unable to extend parameter "%s": only array parameters can be extended.', $matches[1])
                    );
                }

                $config[$matches[2]] = $this->mergeConfigs($config[$matches[1]], $value);

                unset($config[$name]);

                continue;
            }
            if (is_array($value)) {
                $config[$name] = $this->mergeConfigParams($value);
            }
        }

        return $config;
    }
1002171
public function merge($config)
    {
        // override defaults with given config
        if (!empty($config['extra']['helhum/typo3-console']) && is_array($config['extra']['helhum/typo3-console'])) {
            foreach ($config['extra']['helhum/typo3-console'] as $key => $val) {
                $this->config[$key] = $val;
            }
        }
    }
1096489
public function setHeaders($headers, $override = true)
    {
        if ($override == false) {
            $this->headers = array_merge($headers, $this->headers);
        } else {
            $this->headers = $headers;
        }

        return $this;
    }
819634
protected function mergeConfig(array $config)
    {
        foreach ($config as $type => $packages) {
            foreach ($packages as $name => $constraint) {
                $this->addDependency($type, $name, $constraint);
            }
        }
    }
1148185
public function mergeConfig(array $config, $mode = false)
	{
		if ($mode === true)
		{
			$this->config = \Arr::merge($config, $this->config);
		}
		else
		{
			$this->config = \Arr::merge($this->config, $config);
		}

		return $this;
	}
607201
public function hidden($hidden = [], $override = false)
    {
        $this->each(function ($model) use ($hidden, $override) {
            /** @var Model $model */
            $model->hidden($hidden, $override);
        });

        return $this;
    }
319523
public function create(bool $override): bool {
        if ($this->isFile() && !$override) return false;
        $handle = @fopen($this->path, 'w');
        if (false === $handle) return false;
        fclose($handle);
        return true;
    }
430471
public function copy($source, $overrides = [])
    {
        $this->sourceId = $source;
        return $this->sync($overrides) ? $this : null;
    }
1263868
public function setConfig($config)
    {
        $this->config = $config;

        $this->routes = $config['routes'];
        $this->templates = $config['templates'];
        $this->options = $config['options'];
        $this->layoutView = $config['layout'];

        return $this;
    }
1058815
protected function overrideConfig(array $override, Repository $config, Settings $settings, Dispatcher $dispatcher)
    {
        foreach ($override as $key => $settingKey) {
            $configKey = is_string($key) ? $key : $settingKey;

            $dispatcher->fire("settings.overriding: {$configKey}", [$configKey, $settingKey]);

            $settingValue = $settings->get($settingKey);
            $configValue = $config->get($configKey);

            $config->set($configKey, $settingValue);

            $dispatcher->fire("settings.override: {$configKey}", [
                $configKey, $configValue, $settingKey, $settingValue
            ]);
        }
    }