protected function processImports(array $config, $importDir)
    {
        if (isset($config["inherit"])) {
            $filePath = $this->findImportedConfigFile($config["inherit"], $importDir);
            $inheritedConfig = $this->loadConfig($filePath);
            // check for recursive imports or inheritance
            $inheritedConfig = $this->processImports($inheritedConfig, $importDir);
            $config = array_replace_recursive($inheritedConfig, $config);
        }
        if (isset($config["imports"]) && is_array($config["imports"])) {
            foreach ($config["imports"] as $file) {
                $filePath = $this->findImportedConfigFile($file, $importDir);
                $importConfig = $this->loadConfig($filePath);
                // check for recursive imports or inheritance
                $importConfig = $this->processImports($importConfig, $importDir);
                $config = array_replace_recursive($config, $importConfig);
            }
        }

        return $config;
    }
protected function processImports(array $config, $importDir)
    {
        if (isset($config["inherit"])) {
            $filePath = $this->findImportedConfigFile($config["inherit"], $importDir);
            $inheritedConfig = $this->loadConfig($filePath);
            // check for recursive imports or inheritance
            $inheritedConfig = $this->processImports($inheritedConfig, $importDir);
            $config = array_replace_recursive($inheritedConfig, $config);
        }
        if (isset($config["imports"]) && is_array($config["imports"])) {
            foreach ($config["imports"] as $file) {
                $filePath = $this->findImportedConfigFile($file, $importDir);
                $importConfig = $this->loadConfig($filePath);
                // check for recursive imports or inheritance
                $importConfig = $this->processImports($importConfig, $importDir);
                $config = array_replace_recursive($config, $importConfig);
            }
        }

        return $config;
    }
protected function processImports ( array $ config , $ importDir ) { if ( isset ( $ config [ "inherit" ] ) ) { $ filePath = $ this -> findImportedConfigFile ( $ config [ "inherit" ] , $ importDir ) ; $ inheritedConfig = $ this -> loadConfig ( $ filePath ) ; // check for recursive imports or inheritance $ inheritedConfig = $ this -> processImports ( $ inheritedConfig , $ importDir ) ; $ config = array_replace_recursive ( $ inheritedConfig , $ config ) ; } if ( isset ( $ config [ "imports" ] ) && is_array ( $ config [ "imports" ] ) ) { foreach ( $ config [ "imports" ] as $ file ) { $ filePath = $ this -> findImportedConfigFile ( $ file , $ importDir ) ; $ importConfig = $ this -> loadConfig ( $ filePath ) ; // check for recursive imports or inheritance $ importConfig = $ this -> processImports ( $ importConfig , $ importDir ) ; $ config = array_replace_recursive ( $ config , $ importConfig ) ; } } return $ config ; }
Load in any dependent configuration files

Inherited configuration can be overwritten by the current configuration
Imported configuration can overwrite what we already have

Both are restricted to importing files relative to the parent config file

@param array $config
@param $importDir
@return array
Load in any dependent configuration files