@param Config $userConfig

@throws ConfigException
@throws RuntimeException
10959
public function run(Config $userConfig)
    {
        $state         = new State();
        $state->config = new RunnerConfig($userConfig);

        foreach ($this->processors as $processor) {
            $processor->run($state, $this->logger);
        }
    }
212565
public function manipulate(Config $config)
    {
        if ($this->isArrayAppend) {
            $this->appendToArraySetting($config);
        } else {
            $this->setSingleConfigValue($config);
        }
    }
918499
static public function setConfig(array $config)
    {
        foreach ($config as $k => $v) {
            self::$_config[$k] = $v;
        }
    }
984011
protected function _initialize(ObjectConfig $config)
    {
        $config->append(array(
            'priority'   => self::PRIORITY_HIGH,
            'secret'     => '',
            'max_age'    => 900,
            'check_user'   => true,
            'check_age'    => true,
            'check_expire' => true,
        ));

        parent::_initialize($config);
    }
1140079
public function initialize(array $config) {
		$formField = $this->_config['formField'];
		$formFieldRepeat = $this->_config['formFieldRepeat'];
		$formFieldCurrent = $this->_config['formFieldCurrent'];

		if ($formField === $this->_config['field']) {
			throw new RuntimeException('Invalid setup - the form field must to be different from the model field (' . $this->_config['field'] . ').');
		}

		$rules = $this->_validationRules;
		foreach ($rules as $field => $fieldRules) {
			foreach ($fieldRules as $key => $rule) {
				if ($key === 'between') {
					$rule['rule'][1] = $this->_config['minLength'];
					$rule['message'][1] = $this->_config['minLength'];
					$rule['rule'][2] = $this->_config['maxLength'];
					$rule['message'][2] = $this->_config['maxLength'];
				}

				if (is_array($rule['message'])) {
					$message = array_shift($rule['message']);
					$rule['message'] = __d('tools', $message, $rule['message']);
				} else {
					$rule['message'] = __d('tools', $rule['message']);
				}
				$fieldRules[$key] = $rule;
			}
			$rules[$field] = $fieldRules;
		}

		$validator = $this->_table->getValidator($this->_config['validator']);

		// Add the validation rules if not already attached
		if (!count($validator->field($formField))) {
			$validator->add($formField, $rules['formField']);
			$validator->allowEmpty($formField, !$this->_config['require']);
		}
		if (!count($validator->field($formFieldRepeat))) {
			$ruleSet = $rules['formFieldRepeat'];
			$ruleSet['validateIdentical']['rule'][1] = $formField;
			$validator->add($formFieldRepeat, $ruleSet);
			$require = $this->_config['require'];
			$validator->allowEmpty($formFieldRepeat, function ($context) use ($require, $formField) {
				if (!$require && !empty($context['data'][$formField])) {
					return false;
				}
				return !$require;
			});
		}

		if ($this->_config['current'] && !count($validator->field($formFieldCurrent))) {
			$validator->add($formFieldCurrent, $rules['formFieldCurrent']);
			$require = $this->_config['require'];
			$validator->allowEmpty($formFieldCurrent, function ($context) use ($require, $formField) {
				if (!$require && !empty($context['data'][$formField])) {
					return false;
				}
				return !$require;
			});

			if (!$this->_config['allowSame']) {
				$validator->add($formField, 'validateNotSame', [
					'rule' => ['validateNotSame', ['compare' => $formFieldCurrent]],
					'message' => __d('tools', 'valErrPwdSameAsBefore'),
					'last' => true,
					'provider' => 'table'
				]);
			}
		} elseif (!count($validator->field($formFieldCurrent))) {
			// Try to match the password against the hash in the DB
			if (!$this->_config['allowSame']) {
				$validator->add($formField, 'validateNotSame', [
					'rule' => ['validateNotSameHash'],
					'message' => __d('tools', 'valErrPwdSameAsBefore'),
					//'allowEmpty' => !$this->_config['require'],
					'last' => true,
					'provider' => 'table'
				]);
				$validator->allowEmpty($formField, !$this->_config['require']);
			}
		}

		// Add custom rule(s) if configured
		if ($this->_config['customValidation']) {
			$validator->add($formField, $this->_config['customValidation']);
		}
	}
951129
public function processConfiguration($config)
    {
        $factory = new ConfigurationProcessorFactory();
        $processor = $factory->create(gettype($config));
        $config = $processor->convertToObjectConfiguration($config);
        $processor->validate($config);
        $this->config = $config;
    }
585982
public function bootstrap( $config = [] ) {
		if ( $this->isBootstrapped() ) {
			throw new ConfigurationException( static::class . ' already bootstrapped.' );
		}

		$this->bootstrapped = true;
		$this->bootstrapApplication( $config );
	}
1133971
private function configure(array $config = [])
    {
        foreach ($config as $property => $value) {
            if (property_exists($this, $property)) {
                $this->{$property} = $value;
            }
        }
    }
1142485
public function setConfig(array $config)
    {
        if (!isset($config['thumbnailer'])) {
            $this->_thumbnailer = new Thumbnailer();
        } elseif (class_exists($config['thumbnailer'])) {
            $this->_thumbnailer = new $config['thumbnailer'];
        } else {
            throw new ConfigurationException('Class ' . $config['thumbnailer'] . ' does not exist.');
        }

        if (!($this->_thumbnailer instanceof ThumbnailerInterface)) {
            throw new ConfigurationException('Class ' . get_class($this->_thumbnailer) . ' must implement the interface \ysaroka\autothumb\ThumbnailerInterface.');
        }

        if (!isset($config['document_root'])) {
            throw new ConfigurationException('"document_root" key is required.');
        }

        if (!is_dir(realpath($config['document_root']))) {
            throw new ConfigurationException('"document_root": directory "' . $config['document_root'] . '" does not exist.');
        }

        if (!isset($config['types']) || count($config['types']) == 0) {
            throw new ConfigurationException('"types" key is required and should not be empty.');
        }

        foreach ($config['types'] as $type => $params) {
            if (!preg_match('#^[\w\d]+$#', $type)) {
                throw new ConfigurationException('"type": type name "' . $type . '" must contain only words and numbers.');
            }

            if (!isset($params['width'])) {
                $config['types'][$type]['width'] = 100;
            }

            if (!isset($params['height'])) {
                $config['types'][$type]['height'] = 100;
            }

            if (!isset($params['crop'])) {
                $config['types'][$type]['crop'] = true;
            }

            if (!isset($params['stretch'])) {
                $config['types'][$type]['stretch'] = false;
            }

            if (!isset($params['watermark'])) {
                $config['types'][$type]['watermark'] = false;
            } elseif (file_exists($params['watermark']) && !is_dir($params['watermark'])) {
                $config['types'][$type]['watermark'] = realpath($params['watermark']);
                if (isset($params['watermark_pos']) && defined('\ysaroka\autothumb\ThumbnailerInterface::POS_' . strtoupper($params['watermark_pos']))) {
                    $config['types'][$type]['watermark_pos'] = constant('\ysaroka\autothumb\ThumbnailerInterface::POS_' . strtoupper($params['watermark_pos']));
                } else {
                    $config['types'][$type]['watermark_pos'] = ThumbnailerInterface::POS_BOTTOM_RIGHT;
                }
            } else {
                throw new ConfigurationException('Image file "watermark": "' . $params['watermark'] . '" for type "' . $type . '" does not exist.');
            }
        }

        if (isset($config['allowed_extensions']) && is_array($config['allowed_extensions']) && count($config['allowed_extensions']) > 0) {
            $this->_allowedExtensions = $config['allowed_extensions'];
        }

        $this->_documentRoot = realpath($config['document_root']);
        $this->_types = $config['types'];

        return $this;
    }
1011534
public function initialize(array $config)
    {
        $encryptionKey = $this->getConfig('encryptionKey');
        if (!empty($config['encryptionKey'])) {
            $encryptionKey = $config['encryptionKey'];
        }
        if (empty($encryptionKey)) {
            throw new RuntimeException('Encryption key is required.');
        }

        $enabled = $this->getConfig('enabled');
        if (!empty($config['enabled'])) {
            $enabled = $config['enabled'];
        }
        if (!is_callable($enabled) && !is_bool($enabled)) {
            throw new RuntimeException('Enabled flag must be a boolean or a callable which returns a boolean.');
        }
        $this->setConfig($config);
    }
296140
protected function _setup($config) {
        if (empty($config['createdField'])) {
            $config['createdField'] = 'created';
        }
        if (empty($config['modifiedField'])) {
            $config['modifiedField'] = 'modified';
        }
        $this->_fields = $config;
    }
967479
protected function init($config) {
        foreach ($this->loggers as $class => $config) {
            if (!is_array($config)) {
                $class = $config;
                $config = [];
            }
            $instance = $class::get($config);
            if (!is_a($instance, 'mpf\\loggers\\Logger'))
                throw new \Exception("Loggers must extend mpf\\base\\Logger class!");
            $this->loggersInstances[] = $instance;
        }
    }
140640
public function initSession($config)
    {
        $sessionConfig = new SessionConfig();
        $sessionConfig->setOptions($config);
        $sessionManager = new SessionManager($sessionConfig);
        $sessionManager->start();
        Container::setDefaultManager($sessionManager);
    }
987512
public function setRunningConfiguration(RepositoryContract $config)
    {
        // Load the configuration into the current running config.
        foreach ($this->loadConfiguration() as $group => $groupConfig) {
            $config->set($group, $groupConfig);
        }
    }
179540
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = parent::getConfiguration($config, $container);
        if (null === $configuration) {
            throw new \RuntimeException('No configuration found');
        }

        return $configuration;
    }
956379
private function applyConfig($config)
    {
        try {
            if (isset($config['enabledLevels'])) {
                $this->setEnabledLevels($config['enabledLevels']);
            } else {
                $this->setEnabledLevels(['error', 'warning']);
            }

            if (isset($config['flushIntervals'])) {
                $this->setFlushIntervals($config['flushIntervals']);
            } else {
                $this->setFlushIntervals(100);
            }

            if (isset($config['targets'])) {
                foreach ($config['targets'] as $key => $value) {
                    if (isset($value['class'])) {
                        $className = $value['class'];
                        $this->_targets[$key] = $className::build($value);
                    }
                }
            }
        } catch (InvalidConfigurationException $e) {
            $configStr = print_r($config, true);

            error_log('Invalid Configuration for Logger Component. '.PHP_EOL.$configStr);
        }
    }
337262
protected function loadConfig(): void
    {
        $configClass = $this->getConfigClass();
        $configDefinitionClass = $this->getConfigDefinitionClass();
        try {
            $this->config = new $configClass(
                $this->getRawConfig(),
                new $configDefinitionClass()
            );
        } catch (InvalidConfigurationException $e) {
            throw new UserException($e->getMessage(), 0, $e);
        }
    }