Load a config file and its `.local` file if it exists.

@param \MiniAsset\AssetConfig $config The config object to update.
@param string $path The config file to load.
@param string $prefix The prefix to use.
@return void
12443
protected function _load($config, $path, $prefix = '')
    {
        if (file_exists($path)) {
            $config->load($path, $prefix);
        }

        $localConfig = preg_replace('/(.*)\.ini$/', '$1.local.ini', $path);
        if (file_exists($localConfig)) {
            $config->load($localConfig, $prefix);
        }
    }
47759
public function load(array $config, ContainerBuilder $container): void
    {
        $config = $this->processConfiguration($this->getConfiguration([], $container), $config);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');

        if ($config['assets']['enabled']) {
            $loader->load('services/integrations/assets.xml');
        }

        if ($config['templating']['enabled']) {
            $loader->load('services/integrations/templating.xml');
        }

        if ($config['translations']['enabled']) {
            $loader->load('services/integrations/translations.xml');
        }

        $this->resolveConfigurationSources($container, $config);

        $container->setAlias('sylius.context.theme', $config['context']);
        $container->setAlias(ThemeContextInterface::class, 'sylius.context.theme');
    }
1182342
private function invoke($prefix, $path)
    {
        foreach ($this->files($path) as $item) {
            /** @var $item \SplFileInfo */
            $file = $item->getPathname();
            $namePath = str_replace('/', '\\' , substr(substr($file, strlen($path) + 1), 0, -4));
            $class = $prefix . '\\' . $namePath;
            if (! class_exists($class)) {
                continue;
            }

            yield [$class, $file];
        }
    }
1186745
protected function parseConfig($config)
    {
        if (array_key_exists('paths', $config) && array_key_exists('absolute', $config['paths'])) {
            $this->loadThemes($config['paths']['absolute']);
        }
        if (array_key_exists('active', $config)) {
            $this->setCurrent($config['active']);
        }
    }
718383
public function loadModel($path)
    {
        $cfg = Config::newConfig($path);

        $this->loadSection($cfg, 'r');
        $this->loadSection($cfg, 'p');
        $this->loadSection($cfg, 'e');
        $this->loadSection($cfg, 'm');

        $this->loadSection($cfg, 'g');
    }
351330
public function load(Config $config)
    {
        $sys = new Service\SystemService();

        $config->set('CWD', $sys->getCurrentWorkingDirectory());
    }
720098
public function setConfig($config)
    {
        if (is_array($config)) {
            $this->config = new Config($config);
        } else {
            // see if it's a file path
            if (is_file($config)) {
                $cfg = parse_ini_file($config, true);
                $this->config = new Config($cfg);
            } else {
                throw new \InvalidArgumentException(
                    'Could not load configuration file '.$config
                );
            }
        }
    }
677969
public static function loadConfigFiles($configPath = false)
    {
        if(!is_dir($configPath)) {
            throw new \Exception("Config directory {$configPath} not found!");
        }

        $filesToBeLoaded = scandir($configPath);
        foreach($filesToBeLoaded as $_file) {
            if(preg_match('/.*\.php/',$_file)) {
                include_once $configPath.DIRECTORY_SEPARATOR.$_file;
            }
        }

        return true;
    }
1367031
public function load(): void
    {
        if (!$this->path) {
            throw new ConfigException('Configuration directory is not setup');
        }

        $this->config = $this->loadFiles($this->path . '/configs/default');

        if ($this->environment) {
            $customConfig = $this->loadFiles($this->path . '/configs/' . $this->environment);
            $this->config = array_replace_recursive($this->config, $customConfig);
        }
    }
203971
protected function load($config = array())
	{
		// Check whether editor is already loaded
		if (!is_null($this->editor))
		{
			return;
		}

		// Build the path to the needed editor plugin
		$name = (string) preg_replace('/[^A-Z0-9_\.-]/i', '', $this->name);
		$name = ltrim($name, '.');

		$path = PATH_APP . '/plugins/editors/' . $name . '/' . $name . '.php';
		if (!is_file($path))
		{
			$path = PATH_CORE . '/plugins/editors/' . $name . '/' . $name . '.php';
			if (!is_file($path))
			{
				\Notify::error(Lang::txt('JLIB_HTML_EDITOR_CANNOT_LOAD'));
				return false;
			}
		}

		// Require plugin file
		require_once $path;

		// Get the plugin
		$plugin = Plugin::byType('editors', $this->name);

		$params = new Registry($plugin->params);
		$params->merge($config);

		$plugin->params = $params;

		// Build editor plugin classname
		$name = 'plgEditor' . $this->name;

		if ($this->editor = new $name($this, (array) $plugin))
		{
			// Load plugin parameters
			$this->initialise();

			Plugin::import('editors-xtd');
		}
	}
1321020
public function connect(array $config)
    {
        if (isset($config[ 'path' ])) {
            $config[ 'path' ] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config[ 'path' ]);

            if (is_dir($config[ 'path' ])) {
                $this->path = $config[ 'path' ];
            } elseif (defined('PATH_CACHE')) {
                if (is_dir($config[ 'path' ])) {
                    $this->path = $config[ 'path' ];
                } else {
                    $this->path = PATH_CACHE . str_replace(PATH_CACHE, '', $config[ 'path' ]);
                }
            } else {
                $this->path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $config[ 'path' ];
            }
        } elseif (defined('PATH_CACHE')) {
            $this->path = PATH_CACHE;
        } else {
            $this->path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . implode(
                    DIRECTORY_SEPARATOR,
                    ['o2system', 'cache']
                );
        }

        $this->path = rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

        if ($this->isSupported() === false) {
            throw new OverflowException('CACHE_FILE_E_UNABLE_TO_WRITE', 0, [$this->path]);
        }
    }
545434
public function handle(Config $config)
    {
        $sampleOption = $this->option('sample');

        $type = 'empty';
        if( $sampleOption )
        {
            $type = 'sample';
        }

        $from = __DIR__ . '/../../resources/'.$type.'_schema.xml';
        $to = $config->get('propel.propel.paths.schemaDir') . '/' . $config->get('propel.propel.generator.schema.basename') . '.xml';

        if( ! copy($from, $to) )
        {
            throw new \Exception('Failed to copy a file "' . $from . '" to "' . $to . '"');
        }

        $content = file_get_contents($to);

        $name = $config->get('propel.propel.generator.defaultConnection');
        $content = str_replace('**NAME**', $name, $content);

        $nameSpace = $this->laravel->getNamespace() . str_replace(app_path().DIRECTORY_SEPARATOR, '', $config->get('propel.propel.paths.phpDir'));
        $content = str_replace('**NAMESPACE**', $nameSpace, $content);

        file_put_contents($to, $content);

        $this->comment(PHP_EOL . 'Create ' . $to . PHP_EOL);
    }
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;
    }
727086
public function loadConfig($configPath)
    {
        if ( !$configPath ) {
            throw new \InvalidArgumentException('Config path cannot be empty');
        }

        if ( !is_dir($configPath) ) {
            if ( FALSE === strstr($configPath, '.php') ) {
                return;
            }
            $parsed = include $configPath;
            if ( !is_array($parsed) || !$parsed ) {
                return;
            }
            $parsed          = $parsed;
            $this->container = ArrayUtils::merge(
                $this->container,
                $parsed
            );

            return;
        }

        $objects = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($configPath),
            \RecursiveIteratorIterator::SELF_FIRST
        );


        $localObjects = [];

        /**
         * @var string       $name
         * @var \SplFileInfo $object
         */
        foreach ($objects as $object) {
            if ( $object->isDir() ) {
                continue;
            }
            if ( 'php' !== $object->getExtension() ) {
                continue;
            }

            if ( FALSE !== strstr($object->getFilename(), 'local.php') ) {
                $localObjects[ ] = $object;
                continue;
            }

            $parsed = include $object->getRealPath();
            if ( !$parsed || !is_array($parsed) ) {
                continue;
            }

            $parsed          = $parsed;
            $this->container = ArrayUtils::merge(
                $this->container,
                $parsed
            );
        }

        /**
         * @var string       $name
         * @var \SplFileInfo $object
         */
        foreach ($localObjects as $object) {
            $parsed = include $object->getRealPath();
            if ( !$parsed || !is_array($parsed) ) {
                continue;
            }

            $parsed          = $parsed;
            $this->container = ArrayUtils::merge(
                $this->container,
                $parsed
            );
        }

        return $this;
    }
666661
public function load(array $config, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(new Configuration(), $config);

        $provider = $config['provider'];
        $container->setParameter(
            'openclassrooms.cache.default_lifetime',
            $config['default_lifetime']
        );

        $container->setParameter(
            'openclassrooms.cache.cache_provider_type',
            key($provider)
        );

        switch (key($provider)) {
            case CacheProviderType::REDIS:
                $providerConfig = $provider[CacheProviderType::REDIS];
                $container->setParameter('openclassrooms.cache.provider_host', $providerConfig['host']);
                $container->setParameter('openclassrooms.cache.provider_port', $providerConfig['port']);
                $container->setParameter('openclassrooms.cache.provider_timeout', $providerConfig['timeout']);
                break;
            default;
                break;
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
        $loader->load('services.xml');
    }
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;
  }
956782
public function setAsset($path)
	{		
		$url = $this->config['dir']['site'] . str_replace($this->config['dir']['asset'], '', $path);
		$this->assets[] = new Asset($path, $url);
	}