Load a formated configuration

@param string $configName Configuration name in $this->configs
@param array  $config     Configuration data

@return $this
347772
protected function loadConfig($configName, array $config)
    {
        $this->configs[$configName] = $this->normalizeConfig($config);

        return $this;
    }
136957
public function loadFromArray(array $config)
    {
        if (isset($config['domains'])) {
            $this->loadDomainConfiguration($config);
        }

        if (isset($config['general'])) {
            $general = $config['general'];
            $generalConfig = $this->getParsedConfig(
                $general,
                $this->config,
                $this->yamlConfigMap,
                []
            );
            $this->setCache(CacheFactory::get($generalConfig['cacheType'], $generalConfig['cacheOptions']));
            unset($generalConfig['cacheType']);
            unset($generalConfig['cacheOptions']);
            $this->setParsedConfig($generalConfig);
        }

        return $this;
    }
796318
public function load(Config $config)
    {
        $config->setDefault(
            [
                'cs_ruleset'     => 'default',
                'cs_dirs'        => 'src',
                'cs_ignore_dirs' => null,
            ]
        );

        $locations = [
            getcwd().'/'.$config['cs_ruleset'],
            getcwd().'/'.$config['cs_ruleset'].'.xml',
            getcwd().'/ruleset'.(('default' === $config['cs_ruleset']) ? '' : ('-'.$config['cs_ruleset'])).'.xml',
            __DIR__.'/../Resources/rulesets/'.$config['cs_ruleset'].'.xml',
        ];

        foreach ($locations as $location) {
            if (is_file($location)) {
                $config['cs_ruleset'] = realpath($location);
                break;
            }
        }

        $codeSnifferConfFile = getcwd().'/vendor/squizlabs/php_codesniffer/CodeSniffer.conf';

        $config['cs_path_to_install'] = [];

        $found = false;

        if (is_file($codeSnifferConfFile)) {
            include $codeSnifferConfFile;
            if (isset($phpCodeSnifferConfig['installed_paths']) && false !== strpos($phpCodeSnifferConfig['installed_paths'], 'vendor/escapestudios/symfony2-coding-standard')) {
                $found = true;
            }
        }

        if (!$found) {
            $config['cs_path_to_install'][] = 'vendor/escapestudios/symfony2-coding-standard';
        }

        $config['cs_path_to_install'] = join(' ', $config['cs_path_to_install']);

        $config->setDefaultItem('commands', 'cs', "#cs,check code convention");
        $config->setDefaultItem('commands', 'csf', "#cs-fix,fix code convention problems");
        $config->setDefaultItem('commands', 'csx', "#cs-summary,display summary of code convention checking");
    }
800842
protected function loadConfig(array $config)
	{
		$this->className = $config['class'];
		$this->itemPerPage = (int) $config['item_per_page'];
		$this->maxPageNumber = (int) $config['max_page_number'];		
	}
562804
public function connect(array $config, string $name = 'main'): Connection
    {
        if (isset($this->connections[$name])) {
            throw new InvalidArgumentException("Connection [$name] is already configured.");
        }

        $this->connections[$name] = new Connection($config);

        return $this->connections[$name];
    }
1011146
public function setConfig(array $config = [])
    {
        $config = $config + $this->config;

        foreach ($this->defaults as $key => $value) {
            if (!array_key_exists($key, $config)) {
                $config[$key] = $value;
            }
        }

        $this->config = $config;

        return $this;
    }
575177
public function setup($config = [])
    {
        $path = toPath($config['path']);

        if (is_array($config)) {
            $this->setCache($config['name']);
            $this->setPath(CYGNITE_BASE.DS.$path.DS);
            $this->setCacheExtension($config['extension']);

            return $this;
        }

        $this->setCache($config);

        return $this;
    }
943469
public function setConfig($config)
    {
        if (is_array($config)) {
            $this->config = $this->createConfig($config);
        } elseif ($config instanceof ConfigInterface) {
            $this->config = $config;
        } else {
            throw new InvalidArgumentException(
                'Configuration must be an array or a ConfigInterface object.'
            );
        }
        return $this;
    }
229211
public function setConfig($config)
    {
        $this->config = $config;

        $this->routes = $config['routes'];
        $this->options = $config['options'];

        return $this;
    }
544190
public function getConfig($configName)
    {
        if (isset($this->configs[$configName])) {
            return $this->configs[$configName];
        }

        $applicationRootDirectory = $this->get(ServiceProvider::APPLICATION_RUNTIME)->getRootDirectory();
        $configDirectoryPath = $applicationRootDirectory . '/config/';

        $configNameParts = explode('/', $configName);

        $lastPart = array_pop($configNameParts);

        $className = '\\' . implode('\\', $configNameParts) . '\\Config\\' . $lastPart;

        try {
            $config = $this->createNew($className);
        } catch (ClassNotFoundException $e) {
            throw new ConfigNotFoundException('Cannot find the config class for '.$configName.' (tried '.$className.')');
        }

        $inflector = $this->get(ServiceProvider::INFLECTOR);
        $fullConfigDirectoryPath = $configDirectoryPath . $inflector->hyphenate(implode('/', $configNameParts));

        $config->setDirPath($fullConfigDirectoryPath);
        $config->open();
        $this->setConfig($configName, $config);
        return $config;
    }
888117
public function load($config) {
		if ($this->configsDir === null) {
			new Exceptions\ConfiguratorError('Directory of configuration files did not been set');
		}
		
		$file = $this->configsDir->getFile($config);
		
		$this->addConfigReader($this->initReader($file));
		
		return $this;
	}
1246474
private function loadAdapter($adapterName, $configName, array $adapterConfig, ContainerBuilder $container)
    {
        if (isset($adapterConfig['service'])) {
            // Custom adapter service.
            $container->setAlias($adapterName, Utility::cleanServiceName($adapterConfig['service']));
            return $this;
        }

        // Built-In Adapter
        switch ($adapterConfig['type']) {
            case 'jsonapiorg':
                $definition = $this->createJsonApiAdapter($configName, $container);
                break;
            default:
                throw new \RuntimeException(sprintf('The adapter type "%s" is currently not supported.', $adapterConfig['type']));
        }
        $container->setDefinition($adapterName, $definition);
        return $this;

    }
1101803
protected function instantiateConfig($config = null)
    {
        if (is_null($this->config) || ! is_null($config)) {
            $this->config = ! is_null($config)
                ? $config
                : new Config($this->helper);
        }

        return $this->config;
    }
1155939
protected function prepareConfig(array $config)
    {
        $config = new Config($config);
        $config->setFallback($this->getConfig());

        return $config;
    }
526573
private function load(string $configName, $overload = false): bool
    {
        // check if always loaded
        if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) {
            return true;
        }

        // try to load from file
        $configFile = ucfirst(Str::lowerCase($configName)) . '.php';
        if (File::exist('/Private/Config/' . $configFile)) {
            $this->data[$configName] = File::inc('/Private/Config/' . $configFile, true);
            return true;
        }

        return false;
    }
942527
protected function setUpGeneralConfigurations(Configuration $config)
    {
        $this->setupAnnotationMetadata();
        $config->setMetadataDriverImpl($this->getMetadataMappingDriver());

        $config->setProxyDir($this->getProxiesPath());
        $config->setProxyNamespace($this->getProxiesNamespace());
        $config->setAutoGenerateProxyClasses($this->getProxiesAutoGeneration());

        $config->setMetadataCacheImpl($this->getMetadataCacheDriver());
    }
986461
public function setConfig(array $config) {
        $default_account = config('imap.default');
        $default_config  = config("imap.accounts.$default_account");

        foreach ($this->valid_config_keys as $key) {
            $this->$key = isset($config[$key]) ? $config[$key] : $default_config[$key];
        }

        return $this;
    }