loadConfig

@param string|null $customConfigPath
@return array
342745
protected function loadConfig($customConfigPath = null)
    {
        if (is_null($customConfigPath)) {
            $customConfigPath = $this->basePath . DIRECTORY_SEPARATOR . 'config';
        }

        $beverageConfigPath = realpath(__DIR__ . '/../../config');
        $beverageConfigFile = $beverageConfigPath . DIRECTORY_SEPARATOR . 'caffeinated.beverage.php';
        $customConfigFile   = realpath($customConfigPath) . DIRECTORY_SEPARATOR . 'caffeinated.beverage.php';

        $customConfig   = [ ];
        $beverageConfig = require($beverageConfigFile);

        if (file_exists($customConfigFile)) {
            $customConfig = require($customConfigFile);
        }

        $config = array_replace_recursive($beverageConfig, $customConfig);

        return $config[ 'custom_paths' ];
    }
184698
public static function loadFromPath($path)
	{
		// on test do not load plugins
		if(self::isUnableToRunPlugins())
		{
			return;
		}

		if (!file_exists($path))
		{
			throw new InvalidArgumentException("The path [{$path}] doesn't exist to load plugins.");
		}

		$plugins = require $path;

		foreach ($plugins as $plugin)
		{
			if (array_key_exists($plugin, self::$lookup))
			{
				$plugin = __DIR__ . DS . self::$lookup[$plugin];
			}

			if (file_exists($plugin))
			{
				require_once $plugin;
			}
		}

	}
1363660
public function addConfigFromFile($configPath)
    {
        // The file is expected to return a function which can
        // act on the pluginFactory to register any resources needed.
        if (file_exists($configPath)) {
            $configFunction = require($configPath);
            if (is_callable($configFunction)) {
                $configFunction($this);
                return true;
            }
        }
        return false;
    }
204063
public static function detect(string $namespace, string $configPath, string $name = null, bool $strict = true) : array
    {
        $configName = null;
        $method = $strict ? 'get' : 'getIfExists';

        if (is_null($name)) {
            $configName = 'default';
        } elseif (class_exists($name)) {
            $all = self::config()->$method($configPath);
            foreach ($all ?? [] as $key => $value) {
                if (stripos($name, $key) === 0) {
                    $configName = $key;
                    break;
                }
            }
        } elseif (is_string($name)) {
            $configName = $name;
        }

        if (is_null($configName)) {
            if ($strict) {
                throw new \RuntimeException(sprintf(
                    "Can't detect configuration for namespace: '%s', config: '%s', type: '%s'",
                    $namespace,
                    $configPath,
                    is_string($name) ? $name : get_class($name)
                ));
            } else {
                $configName = 'default';
            }
        }

        if ($strict == false && is_null($configName)) {
            if ($return = self::get($namespace, $name)) {
                return [null, null, $return];
            }

            return [$name, null, $return];
        }

        if ($return = self::get($namespace, $configName)) {
            return [null, null, $return];
        }

        $config = self::config()->$method($configPath . '/' . $configName);

        if ($config) {
            return [$configName, $config, null];
        } elseif ($strict == false) {
            return [$configName ?: $name, null, null];
        }
    }
1284625
protected function getConfigurationFilesInPath($configPath)
    {
        $files = [];

        if (! is_dir($configPath)) {
            return $files;
        }

        foreach (Finder::create()->files()->name('*.php')->depth(0)->in($configPath) as $file) {
            $files[$file->getBasename('.php')] = $file->getRealPath();
        }

        ksort($files, SORT_NATURAL);

        return $files;
    }
1172029
private function getCache($configPath)
  {
    if (!isset($this->cacheList[$configPath])) {
      $cachePath = $this->getCachePath($configPath);
      $this->cacheList[$configPath] = new ConfigCache($cachePath, true);
    }

    return $this->cacheList[$configPath];
  }
62692
public function generateBuildConfig($configPath)
    {
        $config = $this->collectConfigs();
        $config['build']['baseUrl'] = './';
        $config['build']['out'] = './' . $config['build_path'];
        $config['build']['mainConfigFile'] = './' . $configPath;
        $paths = [
            // build-in configuration
            'require-config' => './' . substr($configPath, 0, -3),
            // build-in require.js lib
            'require-lib' => 'bundles/ekynarequirejs/require',
        ];
        $config['build']['paths'] = array_merge($config['build']['paths'], $paths);
        $config['build']['include'] = array_merge(
            array_keys($paths),
            //array_keys($config['config']['paths'])
            $config['build']['include']
        );
        return $config['build'];
    }
260932
public function loadFrom(Repository $config, $configPath)
    {
        foreach ($this->filesIn($configPath) as $group => $configFile) {
            $config->set($group, require $configFile);
        }
    }
531549
public function loadPlugin(string $filePath, string $configPath)
    {
        $plugin = (new PluginManager($this, $filePath, new ClassLoader()))->load($configPath);

        $this->instance('wp.plugin.'.$plugin->getHeader('plugin_id'), $plugin);

        return $plugin;
    }
148144
public function localConfigPath(?string $localConfigPath = null) {
        if ($localConfigPath != null) {
            $this->localConfigPath = $localConfigPath;
        }
        else {
            if (!isset($this->localConfigPath)) {
                $this->localConfigPath = $this->basePath() . DIRECTORY_SEPARATOR . "config.local";
            }
        }
        return $this->localConfigPath;
    }
5308
public function load($path, $prefix = '')
    {
        $config = $this->readConfig($path);

        foreach ($config as $section => $values) {
            if (in_array($section, self::$_extensionTypes)) {
                // extension section, merge in the defaults.
                $defaults = $this->get($section);
                if ($defaults) {
                    $values = array_merge($defaults, $values);
                }
                $this->addExtension($section, $values);
            } elseif (strtolower($section) === self::GENERAL) {
                if (!empty($values['timestampPath'])) {
                    $path = $this->_replacePathConstants($values['timestampPath']);
                    $values['timestampPath'] = rtrim($path, '/') . '/';
                }
                $this->set(self::GENERAL, $values);
            } elseif (strpos($section, self::FILTER_PREFIX) === 0) {
                // filter section.
                $name = str_replace(self::FILTER_PREFIX, '', $section);
                $this->filterConfig($name, $values);
            } else {
                $lastDot = strrpos($section, '.') + 1;
                $extension = substr($section, $lastDot);
                $key = $section;

                // must be a build target.
                $this->addTarget($prefix . $key, $values);
            }
        }

        $this->resolveExtends();

        return $this;
    }
292400
protected function loadConfiguration($path)
    {
        try {
            $configuration = Yaml::parse(file_get_contents($path));
            if (!is_array($configuration)) {
                throw new ParseException('Invalid content.', 1);
            }

            return $configuration;
        } catch (ParseException $e) {
            $this->output->writeln(sprintf('<error>Unable to parse the YAML string: %s</error>', $e->getMessage()));

            return [];
        }
    }
939286
public function load($configPath, $targetPath)
  {
    $mapper = new AssetMapper();
    $configDir = dirname($configPath);

    $parameters = $this->loadConfig($configPath);
    foreach ($parameters as $asset) {
      $options = $asset["options"];
      if (isset($options["output"])) {
        $mapper->map(
          $configDir . "/" . $options["output"],
          $targetPath . "/" . $options["output"]
        );
      }
    }

    return $mapper;
  }
231456
function appendCustomConfigImport($customConfigPath)
    {
        $contents = preg_replace('/^conf-file=.*\/\.valet\/.*$/m', '', $this->files->get($this->configPath));
        $this->files->putAsUser($this->configPath, $contents);

        if (! $this->customConfigIsBeingImported($customConfigPath)) {
            $this->files->appendAsUser(
                $this->configPath,
                PHP_EOL.'conf-file='.$customConfigPath.PHP_EOL
            );
        }
    }
1369925
protected function buildAppConfig($configPath)
    {
        $config = require($configPath);

        $callback = Arr::get($this->config, 'callback.vendor_config');
        if ($callback instanceof Closure) {
            $config = call_user_func($callback, $config);
        }

        return $config;
    }
1285008
public function loadFile($path) {
        $content = trim(file_read($path));
        $config = [];

        if ( ! empty($content)) {
            $config = Yaml::parse($content);
        }

        return $config;
    }
46954
protected function loadConfiguration()
    {
        $configuration = null;

        if (file_exists(self::CONFIGURATION_FILENAME)) {
            $configuration = json_decode(file_get_contents(self::CONFIGURATION_FILENAME), true);
        }

        return $configuration ?: array();
    }