Gets and sets purifier configuration sets.

@param string $configName
@param string $config
@throws \InvalidArgumentException
@return \HTMLPurifier
3643
public static function config($configName, $config = null)
    {
        $_this = Purifier::getInstance();

        if (empty($config)) {
            if (!isset($_this->_configs[$configName])) {
                throw new \InvalidArgumentException(sprintf('Purifier configuration `%s` does not exist!', $configName));
            }
            return $_this->_configs[$configName];
        }

        if (is_array($config)) {
            $purifierConfig = \HTMLPurifier_Config::createDefault();
            foreach ($config as $key => $value) {
                $purifierConfig->set($key, $value);
            }

            return $_this->_configs[$configName] = $purifierConfig;
        } elseif (is_object($config) && is_a($config, 'HTMLPurifier_Config')) {
            return $_this->_configs[$configName] = $config;
        } else {
            throw new \InvalidArgumentException('Invalid purifier config passed!');
        }
    }
674316
public static function createFromConfig($config)
    {
        $scaffolder = Injector::inst()->get(self::class);
        if (isset($config['types'])) {
            if (!ArrayLib::is_associative($config['types'])) {
                throw new InvalidArgumentException(
                    '"types" must be a map of class name to settings.'
                );
            }

            foreach ($config['types'] as $dataObjectClass => $settings) {
                $scaffolder->type($dataObjectClass)
                    ->applyConfig($settings);
            }
        }

        $queryMap = [
            'queries' => 'query',
            'mutations' => 'mutation',
        ];

        foreach ($queryMap as $group => $method) {
            if (isset($config[$group])) {
                if (!ArrayLib::is_associative($config[$group])) {
                    throw new InvalidArgumentException(
                        sprintf(
                            '"%s" must be a map of operation name to settings.',
                            $group
                        )
                    );
                }

                foreach ($config[$group] as $fieldName => $fieldSettings) {
                    if (!isset($fieldSettings['type'])) {
                        throw new InvalidArgumentException(
                            sprintf(
                                '"%s" must have a "type" field. See %s',
                                $group,
                                $fieldName
                            )
                        );
                    }

                    $scaffolder->$method($fieldName, $fieldSettings['type'])
                        ->applyConfig($fieldSettings);
                }
            }
        }

        return $scaffolder;
    }
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
                );
            }
        }
    }
449526
public Record setContainerFactoryByConfigName(String configName) {
		Config config = DbKit.getConfig(configName);
		if (config == null)
			throw new IllegalArgumentException("Config not found: " + configName);
		
		processColumnsMap(config);
		return this;
	}
76487
public function withPurifierConfig($config)
    {
        $this->purifierConfig = is_array($config) ? array_merge($this->purifierConfig, $config) : $config;

        return $this;
    }
751413
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = new Configuration($this->getMainConfigParser(), $this->suggestionCollector);
        $configuration->setSiteAccessConfigurationFilters($this->siteaccessConfigurationFilters);

        return $configuration;
    }
1361126
public function getLogger($configName = null) {
        if ($configName === null) {
            $configName = $this->config->getDefaultChannelConfigName();
        }

        if ( ! array_has($this->loggers, $configName)) {
            if ($this->config->getChannelConfig($configName) === null) {
                throw new UndefinedChannelException(s(
                    'Configuration for logging channel "%s" does not exist, this channel can not be created.',
                    $configName
                ));
            }

            $this->loggers[$configName] = $this->createLogger($configName);
        }

        return array_get($this->loggers, $configName);
    }
60576
public function renderUniversalDiscoveryWidgetConfig(string $configName, array $context = []): string
    {
        $config = $this->udwConfigResolver->getConfig($configName, $context);

        $udwConfig = [
            'multiple' => $config['multiple'],
            'activeTab' => $config['active_tab'],
            'visibleTabs' => $config['visible_tabs'],
            'selectedItemsLimit' => $config['selected_items_limit'],
            'startingLocationId' => $config['starting_location_id'],
            'searchResultsPerPage' => $config['search']['results_per_page'],
            'searchResultsLimit' => $config['search']['limit'],
            'allowContainersOnly' => $config['containers_only'],
            'cotfPreselectedLanguage' => $config['content_on_the_fly']['preselected_language'],
            'cotfAllowedLanguages' => $config['content_on_the_fly']['allowed_languages'],
            'cotfPreselectedContentType' => $config['content_on_the_fly']['preselected_content_type'],
            'cotfAllowedContentTypes' => $config['content_on_the_fly']['allowed_content_types'],
            'cotfPreselectedLocation' => $config['content_on_the_fly']['preselected_location'],
            'cotfAllowedLocations' => $config['content_on_the_fly']['allowed_locations'],
            'allowedContentTypes' => $config['allowed_content_types'],
        ];

        return json_encode($udwConfig);
    }
129434
protected function getConfig(array $config): array
    {
        $keys = [
            'auth_key',
            'secret',
            'app_id',
            'options',
            'host',
            'port',
            'timeout',
        ];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $config)) {
                throw new InvalidArgumentException("Missing configuration key [$key].");
            }
        }

        foreach ($config['options'] as $option => $value) {
            if (is_null($value)) {
                unset($config['options'][$option]);
            }
        }

        return array_only($config, $keys);
    }
11389
protected function configureConverterFromInputOptions($converter, $input)
    {
        if (!$converter instanceof ToLatexInterface) {
            throw new \InvalidArgumentException(
                'The converter used to process '
                . $input->getOption('input-format') . ' should implement the '
                . 'phpDocumentor\Plugin\Scrybe\Converter\ToPdfInterface'
            );
        }

        $converter->setTitle($input->getOption('title'));
        $converter->setAuthor($input->getOption('author'));
        $converter->setCoverLogo($input->getOption('cover-logo'));
        $converter->setTableOfContents($input->getOption('toc') !== 'false');
    }
1171866
public function configure(array $config = [])
    {
        if (isset($config['email'])) {
            if (! is_array($config['email'])) {
                throw new InvalidArgumentException('Email configuration should be an array.');
            }
            $this->emailConfig = $config['email'];
        }

        // Check if config has defined a tempDir
        if (isset($config['tempDir']) && is_dir($config['tempDir'])) {
            $this->tempDir = $config['tempDir'];
        }

        return $this;
    }
831584
public static function purify($content, array $options = [])
    {
        $config = HTMLPurifier_Config::createDefault();

        foreach ($options as $key => $value) {
            $config->set($key, $value);
        }

        if (!file_exists($config->get('Cache.SerializerPath'))) {
            mkdir($config->get('Cache.SerializerPath'));
        }

        $purifier = new HTMLPurifier($config);

        return $purifier->purify($content);
    }
623596
public function set(string $name, string $config): self
    {
        try {
            $this->sections[$name] = new SectionConfiguration($config);
        } catch (\Throwable $e) {
            throw new \InvalidArgumentException(
                sprintf('AppSection "%s" configuration is invalid: %s', $name, $e->getMessage()), 0, $e
            );
        }

        return $this;
    }
262851
protected function getNormalizedConfig($configName = null)
    {
        if (isset($this->configs[$configName])) {
            $config = $this->configs[$configName];
        } elseif ($configName === null) {
            $arr = array();
            $config = $this->normalizeConfig($arr);
        } else {
            throw new \Exception(sprintf('Firewall configuration "%s" not found.', $configName));
        }

        return $config;
    }
1178159
public function setOptions(? Iterable $config = null): AdapterInterface
    {
        if (null === $config) {
            return $this;
        }

        foreach ($config as $option => $value) {
            switch ($option) {
                case 'map':
                    $this->map = $value;

                break;
                case 'attr_sync_cache':
                    $this->attr_sync_cache = (int) $value;

                break;
                case 'identity_attribute':
                    $this->identity_attribute = $value;

                break;
                default:
                    throw new InvalidArgumentException('unknown option '.$option.' given');
            }
        }

        return $this;
    }
783282
protected function createLogger($configName) {
        $this->ensureLogFileExists(
            $this->config->getLogFilePathForChannelConfig($configName)
        );

        $stream = new StreamHandler(
            $this->config->getLogFilePathForChannelConfig($configName),
            $this->config->getLogLevelForChannelConfig($configName)
        );
        $logger = new Logger($configName, [$stream]);

        return $logger;
    }
572341
public static function getData($configName)
    {
        $path = __DIR__ . DIRECTORY_SEPARATOR . self::CONFIG_PATH . DIRECTORY_SEPARATOR . $configName . self::CONFIG_EXT;
        if (is_file($path) && file_exists($path)) {
            return require($path);
        }

        return [];
    }