Validates the definition configuration.

@param string $name
@param array $config
@throws \InvalidArgumentException
489477
private function validateDefinitionConfig($name, array &$config)
    {
        if (true === $config['virtual'] && 0 === count($config['property_paths'])) {
            throw new \InvalidArgumentException(sprintf('"property_paths" must be set for "virtual" characteristic "%s".', $name));
        }
        if ($config['type'] === 'datetime') {
            if ($config['format'] === '%s') {
                $config['format'] = 'd/m/Y';
            }
        } elseif (false === strpos($config['format'], '%s')) {
            throw new \InvalidArgumentException(sprintf('"format" must contain "%%s" for characteristic "%s".', $name));
        }
    }
985147
protected function createForConnection($name, array $config = [])
    {
        if (isset($this->customCreators[$name])) {
            return $this->callCustom($name, compact('config'));
        }
    }
518927
public static function addConfig($name, array $config)
    {
        $nameSplit = explode('.', $name);

        $first = array_shift($nameSplit);
        if(!isset(static::$configs[$first]))
        {
            static::$configs[$first] = new ArrayData([]);
        }

        if(isset($nameSplit[0]))
        {
            $configName = implode('.', $nameSplit);
            static::$configs[$first]->set($configName, $config);
            if(false !== ($configs = static::$configs[$first]->get($configName . '.configs')))
            {
                static::load($name, $configs);
            }
        }
        else
        {
            static::$configs[$first]->set($config);
            if(static::$configs[$first]->exists('configs'))
            {
                static::load($name, static::$configs[$first]->get('configs', []));
            }
        }

        return true;
    }
677913
private function isValidConfigs(array $configs): void
    {
        $allowedConfigKeys = $this->getAllowedConfigKeys();
        if (!empty($configs)) {
            foreach ($configs as $key => $value) {
                if (!\in_array($key, $allowedConfigKeys, true)) {
                    throw new InvalidKeyException(sprintf(
                        '%s is not a valid key. configs must only contain "%s".',
                        $key,
                        implode(', ', $allowedConfigKeys)
                    ));
                }

                $this->isBool($key, $value);
                $this->isString($key, $value);
                $this->isValidNBest($key, $value);
            }
        }
    }
383603
protected function makeConnection($name, array $config)
	{
		$this->setOutput($connection = new Connection(

			$name, $config['host'], $config['username'], $this->getAuth($config)

		));

		return $connection;
	}
35988
protected function validateConfig($name)
    {
        if (array_key_exists($name, $this->config) === false) {
            throw new \UnexpectedValueException('No such configuration attribute: ' . $name);
        }
        return $this;
    }
557414
public static function make($name, $config) {
		$required = false;
		if( $config[0] === '+' ) {
			$required = true;
			$config = substr($config, 1);
		}
		list($shortName, $type) = explodeList(':', $config, 2);
		return new static($name, $shortName, $type, $required);
	}
992429
public function setConfig($config)
    {
        if(is_string($config)){
            if (file_exists($config)) {
                $config = \Zend\Config\Factory::fromFile($config);
            } else {
                throw new \InvalidArgumentException(
                    sprintf('Unable to read configurations from file %s',$config));
            }
        }
    
        if(!is_array($config) && !($config instanceof \Traversable)){
            throw new \InvalidArgumentException(
                    sprintf('Config must be an array, Traversable object or filename; %s received',
                            is_object($config) ? get_class($config) : gettype($config)));
        }
    
        $this->setOptions($config);
    }
921424
public static function make(array $config = [], $name = '')
    {
        if (!\is_array($config)) {
            throw new \InvalidArgumentException('Logger config is must be an array and not allow empty.');
        }

        $name = $name ?: ($config['name'] ?? '');

        if (!$name) {
            throw new \InvalidArgumentException('Logger name is required.');
        }

        if (!isset(self::$loggers[$name])) {
            self::$loggers[$name] = new static($config, $name);
        }

        // register shutdown function
        if (!self::$shutdownRegistered) {
            register_shutdown_function(function () {
                // make regular flush before other shutdown functions, which allows session data collection and so on
                self::flushAll();

                // make sure log entries written by shutdown functions are also flushed
                // ensure "flush()" is called last when there are multiple shutdown functions
                register_shutdown_function([self::class, 'flushAll'], true);
            });

            self::$shutdownRegistered = true;
        }

        return self::$loggers[$name];
    }
316407
protected function loadConfiguration(Structure $config, $name = null)
    {
        $name = $name ?: $this->getName();

        // Load library config
        $configName = $this->isWeb() ? 'web' : 'console';

        $config->loadFile(__DIR__ . '/../../config/' . $configName . '.php', 'php', ['load_raw' => true]);

        // Load application config
        $file = $this->rootPath . '/etc/app/' . $name . '.php';

        if (is_file($file)) {
            $config->loadFile($file, 'php', ['load_raw' => true]);
        }

        $configs = (array) $config->get('configs', []);

        ksort($configs);

        foreach ($configs as $file) {
            if ($file === false || !is_file($file)) {
                continue;
            }

            $config->loadFile($file, pathinfo($file, PATHINFO_EXTENSION), ['load_raw' => true]);
        }

        $this->container->setParameters($config);
    }
95191
public function appendExtension($name, array $config = [])
    {
        $merged = array_merge_recursive(
            $this->getExtension($name),
            $config
        );

        $this->addExtension($name, $merged);
    }
635306
public function setConfiguration($config)
    {
        // Load Util Classes / backwards compatibility
        if (is_string($config)) {
            $this->config = new Config (array('language' => $config));
            $this->translator = new Translator($this->config);
        } else if (is_array($config)) {
            $this->translator = new Translator($config);
        } else {
            throw new InvalidArgumentException("Please provide a string or an array as parameter!");
        }

        return $this;
    }
174389
protected function validateConfig(array $config)
    {
        $validator = Validator::make($config, $this->getConfigValidationRules());

        if ($validator->fails()) {

            throw new ServiceConfigurationException(
                'Invalid configuration: ' . print_r($validator->messages()->toArray(), true),
                $validator->messages()->toArray()
            );
        }
    }
1254730
public function set($name = null, $config = null) {
		if (is_array($config)) {
			$this->_configurations[$name] = $config;
			return;
		}
		if ($config === false) {
			unset($this->_configurations[$name]);
		}
	}
430696
public static function create($name, array $config = array())
    {
        if (!isset(self::$config->generators[$name])) {
            throw new Exception("Unknown generator '$name'.");
        }

        $generator = \Yii::createComponent(\CMap::mergeArray(self::$config->generators[$name], $config));
        $generator->init();

        foreach (self::$config->attributes as $attribute => $value) {
            if (property_exists($generator, $attribute)) {
                $generator->$attribute = $value;
            }
        }

        return $generator;
    }
877824
public function configureHook(Config\Hook $config, string $name) : void
    {
        $answer = $this->io->ask('  <info>Enable \'' . $name . '\' hook?</info> <comment>[y,n]</comment> ', 'n');
        $enable = IOUtil::answerToBool($answer);

        $config->setEnabled($enable);

        if ($enable) {
            $addAction = $this->io->ask('  <info>Add a validation action?</info> <comment>[y,n]</comment> ', 'n');

            while (IOUtil::answerToBool($addAction)) {
                $config->addAction($this->getActionConfig());
                // add another action?
                $addAction = $this->io->ask(
                    '  <info>Add another validation action?</info> <comment>[y,n]</comment> ',
                    'n'
                );
            }
        }
    }
123110
protected function callCustomCreator($name, array $config)
    {
        $driver = $config['driver'];

        $callback = $this->customCreators[$driver];

        return call_user_func($callback, $this->app, $name, $config);
    }