Merge packages config

@return  void
328612
protected function mergePackagesConfig()
    {
        $this->getInstaller()
             ->mergeConfigData(
                 'packages.local',
                 include __DIR__ . '/../../../../config/default.packages.php',
                 function ( & $config )
                 {
                     if ( ! empty( $config['modules']['Grid\Core']['enabledPackages'] ) )
                     {
                         foreach ( $config['modules']['Grid\Core']['enabledPackages'] as & $packages )
                         {
                             if ( ! is_array( $packages ) )
                             {
                                 $packages = array(
                                     $packages => (string) $packages
                                 );
                             }

                             $packages = array_unique( array_map(
                                 'strtolower',
                                 array_filter(
                                     $packages,
                                     function ( $package )
                                     {
                                         return (bool) preg_match(
                                             '#^[a-z0-9_-]+/[a-z0-9_-]+$#i',
                                             $package
                                         );
                                     }
                                 )
                             ) );
                         }
                     }

                     return $config;
                 }
             );
    }
11188
private function loadConfigPackages()
    {
        $config = Container::getInstance()->get('config');
        $list   = $config->get('global.package');

        if (empty($list) || !is_array($list)) {
            return;
        }

        foreach ($list as $name => $data) {
            if (!isset($data['config'])) {
                continue;
            }

            $config->loadYamlFromDirectory($data['config']);
        }
    }
829564
public function merge_config()
    {
        $current      = $this->config;
        $this->config = array();

        foreach ($this->replaced_config as $prop => $replacement) {
            if (isset($current[$prop])) {
                if ($prop == 'skin_path') {
                    $this->config[$replacement] = preg_replace('#skins/(\w+)/?$#', '\\1', $current[$prop]);
                }
                else if ($prop == 'multiple_identities') {
                    $this->config[$replacement] = $current[$prop] ? 2 : 0;
                }
                else {
                    $this->config[$replacement] = $current[$prop];
                }
            }

            unset($current[$prop]);
        }

        foreach ($this->obsolete_config as $prop) {
            unset($current[$prop]);
        }

        // add all ldap_public sources having global_search enabled to autocomplete_addressbooks
        if (is_array($current['ldap_public'])) {
            foreach ($current['ldap_public'] as $key => $ldap_public) {
                if ($ldap_public['global_search']) {
                    $this->config['autocomplete_addressbooks'][] = $key;
                    unset($current['ldap_public'][$key]['global_search']);
                }
            }
        }

        $this->config = array_merge($this->config, $current);

        foreach (array_keys((array) $current['ldap_public']) as $key) {
            $this->config['ldap_public'][$key] = $current['ldap_public'][$key];
        }
    }
156232
protected function mergeConfigs(array $configs)
    {
        $merged = array();
        foreach ($configs as $config) {
            $merged = array_merge($merged, $config);
        }

        return $merged;
    }
716253
protected function replaceBoundConfig()
	{
		$configs = $this->app['config']->all();

		$this->app->singleton('config', function () use ($configs) {
			$config = new Repository($configs);
			return $config;
		});
	}
91015
private function loadConfig()
    {
        $cacheName = $this->mode . '_Phavour_Application_config';
        if (false != ($configs = $this->cache->get($cacheName))) {
            // @codeCoverageIgnoreStart
            $this->config = $configs;
            return;
            // @codeCoverageIgnoreEnd
        }

        $config = array();

        foreach ($this->packagesMetadata as $package) {
            try {
                $finder = new FromArray($package['config_path']);
                $proposedConfig = $finder->getArrayWhereKeysBeginWith($package['package_name']);
                if (is_array($proposedConfig)) {
                    $config = array_merge($config, $proposedConfig);
                }
            } catch (\Exception $e) {
                // Package doesn't have config
            }
        }

        try {
            $finder = new FromArray(
                $this->appDirectory . DIRECTORY_SEPARATOR . 'res' . DIRECTORY_SEPARATOR . 'config.php'
            );
            $appConfig = $finder->getArray();
            if (is_array($appConfig)) {
                $config = array_merge($config, $appConfig);
            }
        } catch (\Exception $e) {
            // No config overrides set
        }

        $this->config = $config;
        $this->cache->set($cacheName, $this->config, 86400);
    }
1233821
public function config()
    {
        // Publish Config
        $this->publishes([
            __DIR__ . '/../config/laravel-forum.php' => config_path('laravel-forum.php'),
        ], 'config');

        $this->mergeConfigFrom(
            __DIR__ . '/../config/laravel-forum.php',
            'laravel-forum'
        );

        // Merge default Config
        $published = __DIR__.'/../../../../config/laravel-forum.php';
        if (file_exists($published)) {
            $this->mergeConfigFrom(
                $published,
                'laravel-forum'
            );
        }
    }
607361
protected function afterInstall()
    {
        $configSourceFile = __DIR__ . DIRECTORY_SEPARATOR . 'config.example.php';
        $configTargetFile = \Craft::$app->getConfig()->configDir . DIRECTORY_SEPARATOR . $this->handle . '.php';

        if (!file_exists($configTargetFile)) {
            copy($configSourceFile, $configTargetFile);
        }
    }
462777
protected function mergeIncludes(&$config)
    {
        if (!empty($config['includes'])) {
            foreach ($config['includes'] as $path) {

                // Don't load the same files more than once
                if (!array_key_exists($path, $this->loadedFiles)) {
                    $this->loadedFiles[$path] = true;
                    $config = array_merge_recursive($this->load($path), $config);
                }
            }
            unset($config['includes']);
        }
    }
225343
protected static function mergeConfig($newData, &$baseConfig)
    {
        if (is_array($newData)) {
            foreach ($newData as $key => $value) {
                if (isset($baseConfig[$key])) {
                    self::mergeConfig($value, $baseConfig[$key]);
                } else {
                    $baseConfig[$key] = $value;
                }
            }
        } else {
            $baseConfig = $newData;
        }
    }
899789
protected function updatePackages()
    {
        if (! $this->filesystem->exists(base_path('package.json'))) {
            return;
        }

        $packages = json_decode(file_get_contents(base_path('package.json')), true);
        $packages['devDependencies'] = $this->updatePackageArray(
            $packages['devDependencies']
        );
        ksort($packages['devDependencies']);

        $this->filesystem->put(
            base_path('package.json'),
            json_encode($packages, JSON_PRETTY_PRINT)
        );
    }
1095099
public function mergeSettings($newSettings)
    {
        if (\is_object($this->getSettings())) {
            $settingsClass = \get_class($this->getSettings());
            $settings = $settingsClass::createFromArray($newSettings, $this->getSettings());
        } else {
            $settings = \array_replace($this->getSettings(), $newSettings);
        }

        $this->setSettings($settings);
    }
895748
protected function configHandle()
    {
        $packageConfigPath = __DIR__.'/config/config.php';
        $appConfigPath     = config_path('comment.php');

        $this->mergeConfigFrom($packageConfigPath, 'comment');

        $this->publishes([
            $packageConfigPath => $appConfigPath,
        ], 'config');
    }
1067895
function merge(self $config): void {
    foreach ($config as $key => $value) $this[$key] = $value;
  }
894668
public function boot()
    {
        /**
         * Publishing package's config
         */
        $packageConfigPath = __DIR__ . '/../../config/config.php';
        $appconfigPath     = config_path('log-reader.php');

        $this->mergeConfigFrom($packageConfigPath, 'log-reader');

        $this->publishes([
            $packageConfigPath => $appconfigPath,
        ], 'config');
    }
1014651
public function merge(array $config, $type)
    {
        foreach ($config as $key => $val) {
            $this->set($key, $val, $type);
        }
    }
499682
def _merge_includes(self):
        
        raw_include_path = self.get_global_include()
        if raw_include_path:
            abs_include_path = self._get_global_include_abs_path(
                raw_include_path
            )
            self._validate_global_include(abs_include_path)
            self.set_global_include(abs_include_path)

            for infile in glob.glob(abs_include_path):
                self.config.merge(
                    self._configobj_factory(infile=infile)
                )