Merges in all include files

@param array  $config   Config data that contains includes
@param string $basePath Base path to use when a relative path is encountered

@return array Returns the merged and included data
421435
protected function mergeIncludes(&$config, $basePath = null)
    {
        if (!empty($config['includes'])) {
            foreach ($config['includes'] as &$path) {
                // Account for relative paths
                if ($path[0] != DIRECTORY_SEPARATOR && !isset($this->aliases[$path]) && $basePath) {
                    $path = "{$basePath}/{$path}";
                }
                // Don't load the same files more than once
                if (!isset($this->loadedFiles[$path])) {
                    $this->loadedFiles[$path] = true;
                    $config = $this->mergeData($this->loadFile($path), $config);
                }
            }
        }
    }
159417
private function includeFile($path)
    {
        $shopgate_config = null;

        // try including the file
        if (file_exists($path)) {
            ob_start();
            /** @noinspection PhpIncludeInspection */
            include($path);
            ob_end_clean();
        } else {
            return false;
        }

        // check $shopgate_config
        if (!isset($shopgate_config) || !is_array($shopgate_config)) {
            return false;
        } else {
            return $shopgate_config;
        }
    }
1109087
private function getMergedConfigValues(array $config)
    {
        $mergedConfig = array();

        foreach ($config as $paymentConfig) {
            $mergedConfig[$paymentConfig->getName()] = $paymentConfig->getValue();
        }

        return $mergedConfig;
    }
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;
    }
666245
public function getByBaseId( $baseId, $config = [] ) {

		$modelClass	= self::$modelClass;

		return $modelClass::queryByBaseId( $baseId, $config )->all();
	}
1087633
public function getFilesList( $basePath )
    {
        // The custom iterator filters out the file path in order to get a relative one
        return new eZDFSFileHandlerDFSBackendFilterIterator(
            new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator(
                    $this->mountPointPath . '/' . $basePath,
                    FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS
                )
            ),
            $this->mountPointPath
        );
    }
1050750
public function merge(Config $config)
    {
        $this->data = array_replace_recursive(
            $this->data,
            $config->toArray()
        );

        return $this;
    }
554707
protected function importResource(BaseConfig $baseConfig)
    {
        foreach ($baseConfig as $key => $value) {
            if ($value instanceof BaseConfig) {
                $this->importResource($value);
            } elseif (is_string($value)) {
                if ($key === self::RESOURCES_KEY) {
                    $resources = $this->clear(
                        $baseConfig,
                        $this->create($value)
                    );
                    $baseConfig->merge($resources);
                    $baseConfig->offsetUnset($key);

                } elseif (substr_count($value, self::RESOURCES_VALUE)) {
                    $baseConfig[$key] = $this->create(
                        substr($value, strlen(self::RESOURCES_VALUE))
                    );

                } elseif ($key === self::MODULE_KEY) {
                    $resources = $this->clear(
                        $baseConfig,
                        $this->moduleConfigCreate($value)
                    );

                    $baseConfig->merge($resources);
                    $baseConfig->offsetUnset($key);

                } elseif (substr_count($value, self::MODULE_VALUE)) {
                    $baseConfig[$key] =
                        $this->moduleConfigCreate(
                            substr(
                                $value,
                                strlen(self::MODULE_VALUE)
                            )
                        );

                }

                if (substr_count($value, self::ENVIRONMENT)) {
                    $baseConfig[$key] = str_replace(
                        self::ENVIRONMENT,
                        $this->environment,
                        $value
                    );
                }
            }
        }
    }
1025953
private function mergeBasePath()
    {
        if (null !== $this->baseUri->authority && '' === $this->baseUri->path) {
            $this->path = '/' . $this->path;
        } else {
            if (false !== $lastSlashPos = strrpos($this->baseUri->path, '/')) {
                $basePath = substr($this->baseUri->path, 0, $lastSlashPos + 1);
                $this->path = $basePath . $this->path;
            }
        }
    }
1089372
protected function mergeOptions($options)
    {
        $config = Configuration::config();
        $baseOptions = array_merge($this->options, $config['settings']);
        return array_merge($baseOptions, $options);
    }
898863
protected function writeBuildConfig($basePath)
    {
        $configPath = $this->getVendorAppConfig($basePath);

        if (! is_writable($configPath)) {
            throw new RuntimeException('The config/app.php file must be present and writable.');
        }

        $config = $this->buildAppConfig($configPath);

        file_put_contents($configPath, '<?php return '.var_export($config, true).';');
    }
941775
public static function append(array $config = [])
    {
        self::$config = self::mergeConfigs(self::$config, $config);

        if (isset(self::$config['paths']['output'])) {
            self::$outputDir = self::$config['paths']['output'];
        }
        if (isset(self::$config['paths']['data'])) {
            self::$dataDir = self::$config['paths']['data'];
        }
        if (isset(self::$config['paths']['support'])) {
            self::$supportDir = self::$config['paths']['support'];
        }
        if (isset(self::$config['paths']['tests'])) {
            self::$testsDir = self::$config['paths']['tests'];
        }

        return self::$config;
    }
684606
public function mergeWith($config)
    {
        if ($this->isArray($config) || $this->isArrayObject($config)) {
            $config = Config::getInstance()->php(StdObjectWrapper::toArray($config));
        }

        foreach ($config as $key => $value) {
            if ($this->data->keyExists($key)) {
                if (is_numeric($key)) {
                    $this->data[$key] = $value;
                    continue;
                } elseif ($value instanceof ConfigObject && $this->data[$key] instanceof ConfigObject) {
                    $this->data[$key]->mergeWith($value);
                    continue;
                }
            }
            $this->data[$key] = $value instanceof ConfigObject ? new ConfigObject($value->toArray()) : $value;
        }

        return $this;
    }
672706
public static function within($listenerPath, $basePath)
    {
        return collect(static::getListenerEvents(
            (new Finder)->files()->in($listenerPath), $basePath
        ))->mapToDictionary(function ($event, $listener) {
            return [$event => $listener];
        })->all();
    }
1218695
function getFilePath(basePath, relativePath) {
        var count = 0,
            array1, array2;
        for (var i = 0, length = relativePath.length; i < length; i++) {
            if (relativePath[i] == '..') {
                count++;
            }
        }
        array1 = basePath.slice(0, basePath.length - 1 - count);
        array2 = relativePath.slice(count);
        return array1.concat(array2);
    }
808380
private function getAllFiles(Config $config)
    {
        $file_extensions = $config->getFileExtensions();
        $file_paths = [];

        foreach ($config->getProjectDirectories() as $dir_name) {
            $file_paths = array_merge(
                $file_paths,
                $this->file_provider->getFilesInDir($dir_name, $file_extensions)
            );
        }

        return $file_paths;
    }
321941
public function create(string $rootPath, string $configFilePath): ConfigBagInterface
    {
        $file = $this->resolvePath($rootPath, $configFilePath);

        $envs = $this->parseMainFile($file);
        $envs = $this->mergeExternalFiles($file, $envs);

        return ConfigBag::root(
            $envs,
            $this->getEnvironment(),
            $rootPath
        );
    }