Merges $CFG->behat_profiles with the one passed.

@param array $config existing config.
@return array merged config with $CFG->behat_profiles
422828
public function merge_behat_profiles($config) {
        global $CFG;

        // Check for Moodle custom ones.
        if (!empty($CFG->behat_profiles) && is_array($CFG->behat_profiles)) {
            foreach ($CFG->behat_profiles as $profile => $values) {
                $config = $this->merge_config($config, $this->get_behat_profile($profile, $values));
            }
        }

        return $config;
    }
1224131
protected function doSetup($config = array())
    {
        // Catch the configuration file path
        if (isset($config[self::CONFIG_KEY_FILE_PATH])) {
            $this->configFilePath = $config[self::CONFIG_KEY_FILE_PATH];
        } else {
            // Also consider throwing an exception here instead
            // of failing silently
            return $config;
        }

        // Catch the context
        if (isset($config[ConfigInterface::KEY_CONTEXT])) {
            $this->context = $config[ConfigInterface::KEY_CONTEXT];
        }

        return $this->readConfigurationFiles();
    }
1041946
public function config($config)
    {
        if (is_array($config)) {
            $this->config = array_merge($this->config, $config);
        } elseif (isset($this->config[$config])) {
            return $this->config[$config];
        } else {
            return;
        }
    }
239534
protected function normalizeConfig(array $config)
    {
        foreach ($this->configModel as $elmt => $settings) {
            if (!isset($config[$elmt])) {
                $config[$elmt] = $settings['default'];
            }
        }

        foreach ($config as $elmtName => $value) {
            if (!isset($this->configModel[$elmtName])) {
                unset($config[$elmtName]);
            }
        }

        return $config;
    }
1367117
protected function normalizeConfig(array $config)
    {
        $hasVariantsConfigured = Arr::has($config, 'variants');

        $variantList = $this->castVariantsToVariantList(Arr::get($config, 'variants', []));

        if ( ! $hasVariantsConfigured || $this->shouldMergeDefaultVariants()) {
            $variantList->mergeDefault(config('paperclip.variants.default', []));
        }

        $extensions = $variantList->extensions();
        $urls       = $variantList->urls();

        Arr::set($config, 'variants', $variantList->variants());


        // Merge in extensions set through indirect means.
        if (count($extensions)) {
            Arr::set(
                $config,
                'extensions',
                array_merge(Arr::get($config, 'extensions', []), $extensions)
            );
        }

        // Merge in default URLs set through indirect means.
        if (count($urls)) {
            Arr::set(
                $config,
                'urls',
                array_merge(Arr::get($config, 'urls', []), $urls)
            );
        }

        return $config;
    }
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;
	}
546247
public static function config($config = []) {
		if (!$config) {
			return ['classes' => static::$_classes, 'unicode' => static::$_unicode];
		}
		if (isset($config['classes'])) {
			static::$_classes = $config['classes'] + static::$_classes;
		}
		if (isset($config['unicode'])) {
			static::$_unicode = $config['unicode'];
		}
	}
318070
public function loadCachedConfig(array &$config)
    {
        $cacheFilePath = $this->config->getCacheFile();

        if (!file_exists($cacheFilePath)) {
            return false;
        }

        $cachedConfig = include $cacheFilePath;

        if (!is_array($cachedConfig)) {
            return false;
        }

        if (!isset($config['routes'])) {
            $config['routes'] = array();
        }

        $this->merger->merge($cachedConfig, $config['routes']);

        return true;
    }
745963
protected function mergeProfileWithConfig(array $profile)
    {
        foreach ($profile as $directive => $values) {
            if (!isset($this->config[$directive])) {
                $this->config[$directive] = [];
            }

            $values = $this->getArrayFromValue($values);

            $this->config[$directive] = array_merge($this->config[$directive], $values);
        }
    }
1199914
public function config($config = null) {
		if ($config) {
			if (!is_array($config)) {
				return isset($this->_config[$config]) ? $this->_config[$config] : null;
			}
			$this->_config = $config + $this->_config;
		}
		return $this->_config;
	}
547525
private function resolveConfig(array $config)
    {
        if (!isset($config['httpHandler'])) {
            $config['httpHandler'] = HttpHandlerFactory::build();
        }

        if (!isset($config['asyncHttpHandler'])) {
            $isGuzzleHandler = $config['httpHandler'] instanceof Guzzle6HttpHandler
                || $config['httpHandler'] instanceof Guzzle5HttpHandler;
            $config['asyncHttpHandler'] = $isGuzzleHandler
                ? [$config['httpHandler'], 'async']
                : [HttpHandlerFactory::build(), 'async'];
        }

        return array_merge($this->config, $config);
    }
156232
protected function mergeConfigs(array $configs)
    {
        $merged = array();
        foreach ($configs as $config) {
            $merged = array_merge($merged, $config);
        }

        return $merged;
    }
1206294
private function convert(array $config)
    {
        foreach ($config as $index => $data) {
            if (is_array($data)) {
                $config[$index] = new Config($data);
            }
        }

        return $config;
    }
323981
protected function mergeConfigs(array $configs)
    {
        $mergedConfig = array();
        
        foreach($configs as $config)
        {
            $mergedConfig = array_merge_recursive($mergedConfig, $config);
        }
        
        return  array($mergedConfig);
    }
88595
public function setConfig(array $config, $merge = true)
    {
        $this->config = $merge ? \array_merge($this->config, $config) : $config;

        return $this;
    }
401729
protected function getRequestConfig(array $config) : array
    {
        if (!empty($this->defaultRequestOptions)) {
            $config = array_replace_recursive($this->defaultRequestOptions, $config);
        }

        return $config;
    }
251753
public function merge(array $newConfig, array &$config)
    {
        foreach ($newConfig as $routeName => $routeInfo) {
            if (!isset($config[$routeName])) {
                $config[$routeName] = $this->newRoute($routeName, $routeInfo);
            }

            if (isset($routeInfo['child_routes'])) {
                if (!isset($config[$routeName]['child_routes'])) {
                    $config[$routeName]['child_routes'] = array();
                }

                $this->merge($routeInfo['child_routes'], $config[$routeName]['child_routes']);
            }
        }
    }