Nelmio\SecurityBundle\DependencyInjection\Configuration::addReportOrEnforceNode PHP Method

addReportOrEnforceNode() private method

private addReportOrEnforceNode ( $reportOrEnforce )
    private function addReportOrEnforceNode($reportOrEnforce)
    {
        $builder = new TreeBuilder();
        $node = $builder->root($reportOrEnforce);
        $children = $node->children();
        // Symfony should not normalize dashes to underlines, e.g. img-src to img_src
        $node->normalizeKeys(false);
        $children->booleanNode('level1_fallback')->info('Provides CSP Level 1 fallback when using hash or nonce (CSP level 2) by adding \'unsafe-inline\' source. See https://www.w3.org/TR/CSP2/#directive-script-src and https://www.w3.org/TR/CSP2/#directive-style-src')->defaultValue(true)->end();
        $children->arrayNode('browser_adaptive')->canBeEnabled()->info('Do not send directives that browser do not support')->addDefaultsIfNotSet()->children()->scalarNode('parser')->defaultValue('nelmio_security.ua_parser.ua_php')->end()->end()->beforeNormalization()->always(function ($v) {
            if (!is_array($v)) {
                @trigger_error("browser_adaptive configuration is now an array. Using boolean is deprecated and will not be supported anymore in version 3", E_USER_DEPRECATED);
                return array('enabled' => $v, 'parser' => 'nelmio_security.ua_parser.ua_php');
            }
            return $v;
        })->end()->end();
        foreach (DirectiveSet::getNames() as $name => $type) {
            if (DirectiveSet::TYPE_NO_VALUE === $type) {
                $children->booleanNode($name)->defaultFalse()->end();
            } elseif ($name === 'report-uri') {
                $children->arrayNode($name)->prototype('scalar')->end()->beforeNormalization()->ifString()->then(function ($value) {
                    return array($value);
                })->end()->end();
            } elseif (DirectiveSet::TYPE_URI_REFERENCE === $type) {
                $children->scalarNode($name)->end();
            } else {
                $children->arrayNode($name)->prototype('scalar')->end();
            }
        }
        return $children->end();
    }