Cargar la configuracion de aplicacion.
Aqui se inicializa los módulos y sus dependencias.

@param $config
@throws \Exception
555224
public function loadConfig($config, $parent = null)
    {
        $modules = $config['modules'];
        if (!is_array($modules)) {
            $modules = array($modules);
        }
        // Los modulos se definen de la siguiente manera:
        // modules:
        //      [path_to_module]:
        //          [module_folder]: { [extra_config] }

        // Pre-load modules:
        $resolv = array();
        foreach ($modules as $folder => $list) {
            // Resolver el tipo de directorio
            if ((string)$folder === 'internal') { // Para especificar un modulo interno
                $folder = __DIR__ . '/../../modules';
            } elseif (is_numeric($folder)) { // Para especificar un modulo simple
                $folder = $this->directory . 'modules';
            } else {
                $folder = $this->directory . fix_folder($folder);
            }
            if (!is_array($list)) {
                $list = array($list);
            }

            foreach ($list as $name => $moduleConfig) {
                if (is_int($name) && empty($moduleConfig)) { // Tipo: [0] => ''
                    continue;
                }
                if (!is_string($name) && is_array($moduleConfig)) {
                    $name = key($moduleConfig);
                    $moduleConfig = current($moduleConfig);
                } elseif (is_int($name)) {
                    // tipo: "- admin" o "admin"
                    $name = $moduleConfig;
                    $moduleConfig = array();
                }
                $path = $folder . '/' . $name;
                if (!isset($resolv[$path])) {
                    $resolv[$path] = array('name' => $name, 'config' => array());
                }
//                $resolv[$name][] = $moduleConfig;
                $resolv[$path]['config'] = array_merge_recursive_ex($resolv[$path]['config'], $moduleConfig);
            }
        }
        foreach ($resolv as $path => $info) {
            $moduleConfig = $info['config'];
            $name = $info['name'];
            $module = $this->load($path, $moduleConfig);
            if ($module) {
                if (!$this->exists($module->title)) {
                    $module->setParentModule($parent);
                    $this->add($module);
                    $this->loadModuleDependencies($module);
                }

                //$parent->addChildrenModule(self::getModuleInstanceByName($module->title));
            } else {
                throw new \Exception('Can\'t not load module: ' . $name . ' in directory: \'' .
                    $path . '\'');
            }
        }
    }
1050200
public function init($config = [])
    {
        $type  = isset($config['type']) ? $config['type'] : 'File';
        $class = false !== strpos($type, '\\') ? $type : '\\think\\log\\driver\\' . ucwords($type);

        $this->config = $config;

        unset($config['type']);

        if (class_exists($class)) {
            $this->driver = new $class($config);
        } else {
            throw new Exception('class not exists:' . $class, $class);
        }

        return $this;
    }
305455
public function initConfig($config)
    {  
        if (is_string($config)) {
            if (file_exists(($configFile = $config)) ||
                file_exists(($configFile = dirname(dirname(__FILE__)).self::DS.$config))
            ) {
                $config = $this->loadConfig($configFile);
            }
        } elseif (!is_array($config) && !is_object($config)) {
            throw new \Exception("Invalid configuration.", 1);
        }

        $this->mergeConfig($config);

        $this->doCallback('configurationInitiated', array($this->_configuration, $this));

        return $this;
    }
262167
public static function init($config, $collectionConfig = array())
    {
        $first = null;

        static::$collectionConfig = $collectionConfig;

        if (empty($config)) {
            return;
        }

        foreach ($config as $key => $value) {
            $value['name'] = $key;

            if (!isset($value['driver'])) {
                throw new Exception(
                    '[Norm] Cannot instantiate connection "'.$key.
                    '", Driver "'.@$value['driver'].'" not found!'
                );
            }

            $Driver = $value['driver'];

            static::$connections[$key] = new $Driver($value);

            if (!static::$connections[$key] instanceof Connection) {
                throw new Exception('Norm connection ['.$key.'] should be instance of Connection');
            }

            if (!$first) {
                $first = $key;
            }
        }

        if (!static::$defaultConnection) {
            static::$defaultConnection = $first;
        }
    }
1192974
public function setConfig($config)
	{
		if (is_object($config)) {
			$config = get_object_vars($config);
		}
		foreach ($config as $index => $value) {
			$this->$index = $value;
		}
	}
636320
public function initialize(array $config)
    {
        parent::initialize($config);

        $this->_action = $this->_controller->request->getParam('action');
        $this->_request = $this->_controller->request;

        if (!isset($this->_controller->dispatchComponents)) {
            $this->_controller->dispatchComponents = [];
        }

        $this->_controller->dispatchComponents['Crud'] = true;
    }
1233808
public function initialize(array $config)
    {
        $this->_translationTable = $this->getTableLocator()->get($this->_config['translationTable']);

        $this->setupFieldAssociations(
            $this->_config['fields'],
            $this->_config['translationTable'],
            $this->_config['referenceName'],
            $this->_config['strategy']
        );
    }
956379
private function applyConfig($config)
    {
        try {
            if (isset($config['enabledLevels'])) {
                $this->setEnabledLevels($config['enabledLevels']);
            } else {
                $this->setEnabledLevels(['error', 'warning']);
            }

            if (isset($config['flushIntervals'])) {
                $this->setFlushIntervals($config['flushIntervals']);
            } else {
                $this->setFlushIntervals(100);
            }

            if (isset($config['targets'])) {
                foreach ($config['targets'] as $key => $value) {
                    if (isset($value['class'])) {
                        $className = $value['class'];
                        $this->_targets[$key] = $className::build($value);
                    }
                }
            }
        } catch (InvalidConfigurationException $e) {
            $configStr = print_r($config, true);

            error_log('Invalid Configuration for Logger Component. '.PHP_EOL.$configStr);
        }
    }
366633
public static function init($config = null)
    {
        self::loadConfig($config);

        if (!($redis = Configure::read('CakeResque.Redis'))) {
            throw new ConfigureException(__d('cake_resque', 'There is an error in the configuration file.'));
        }

        if (
            empty($redis['host']) ||
            empty($redis['port']) ||
            (empty($redis['database']) && !is_numeric($redis['database'])) ||
            empty($redis['namespace'])
        ) {
            throw new ConfigureException(__d('cake_resque', 'There is an error in the Redis configuration key.'));
        }

        Resque::setBackend($redis['host'] . ':' . $redis['port'], $redis['database'], $redis['namespace'], $redis['password']);
    }
1013204
protected function setup(array $config = [])
    {
        if (!isset($config['data_provider'])) {
            throw new Exception(translate('{data_provider} must be a DatapPovider objetc'), 500, Exception::BADARGUMENTS);
        } elseif (isset($config['data_provider']) && !($config['data_provider'] instanceof DataProviderInterface)) {
            throw new Exception(translate('{data_provider} must be a DatapPovider objetc'), 500, Exception::BADARGUMENTS);
        }

        if (!isset($config['columns'])) {
            throw new Exception(translate('{columns} must be an array type Column[]'), 500, Exception::BADARGUMENTS);
        }

        parent::setup($config);

        $this->setupColumns();
    }
129616
public function setConfigArray($config)
    {
        if (is_null($config) || !is_array($config)) {
            throw new \Exception(Lang::get('missing_phpci_yml'));
        }

        $this->config = $config;
    }
982815
private function applyConfig(array $config): void
    {
        // override
        if ($this->config != null) {
            $config = Config::merge($config, $this->config->getData());
        }
        $this->config = new Config($config);

        // set/reset logger options
        $loggerOptions = $this->config->get('logger');
        if ($loggerOptions != null) {
            isset($loggerOptions['level']) && $this->logger->setLevel($loggerOptions['level']);
            isset($loggerOptions['directory']) && $this->logger->setDirectory($loggerOptions['directory']);
        }
    }
824166
public function initialize(array $config)
    {
        if (!$this->_config['key']) {
            $this->setConfig('key', Security::getSalt());
        }

        $controller = $this->_registry->getController();

        if ($controller === null) {
            $this->request = ServerRequestFactory::fromGlobals();
        }

        if (empty($this->_config['path'])) {
            $this->setConfig('path', $this->getController()->getRequest()->getAttribute('webroot'));
        }
    }
1287349
public function setConfiguration(Configuration $config)
    {
        if ($config === null) {
            throw new Exception\InvalidArgumentException('$config cannot be null');
        }


        if ($this->config !== null) {
            $this->config->unregisterConfigChangeListener($this->getConfigChangeListener());
        }

        $this->config = $config;
        $this->setOptions($config->getZendLdapConfiguration());
        $this->config->registerConfigChangeListener($this->getConfigChangeListener());
    }
1290797
public function setConfig($config)
    {
        if (is_array($config)) {
            $this->config = $config;
        } else {
            $this->config = (array) gplcart_config_get((string) $config);
            $this->setDb($this->config['database']);
            $this->config = array_merge($this->config, $this->select());
        }
    }
821610
public function setConfiguration($config)
    {
        $this->config = $config;
        $encoded = json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
        file_put_contents($this->appRoot . '/config.json', $encoded);
    }
103590
public function setConfig($config){
        $this->config = $config;
        foreach ($config as $key => $value) {
            $this->app->config($key, $value);
        }
    }