public function addCryptoNode($type)
    {
        $nodeName = $type.'ion';

        $treeBuilder = new TreeBuilder($nodeName);

        $rootNode = $this->getRootNodeFromTreeBuilder($treeBuilder, $nodeName);

        $rootNode
            ->info('Configure '.$type.'er.')
            ->isRequired()
            ->fixXmlConfig('argument')
            ->children()
                ->scalarNode('service')
                    ->info('Symfony service name of '.$type.'er.')
                    ->isRequired()
                    ->cannotBeEmpty()
                ->end()
                ->arrayNode('key')
                    ->info(ucfirst($type).'ion key settings.')
                    ->beforeNormalization()
                        ->ifTrue(function ($v) {
                            return \is_string($v);
                        })
                        ->then(function ($v) {
                            return ['value' => $v];
                        })
                    ->end()
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('value')
                            ->info('Either the key or a password to use for key generation.')
                            ->defaultValue('')
                        ->end()
                        ->booleanNode('base64_encoded')
                            ->info('Key / password (value) is base64 encoded.')
                            ->defaultFalse()
                        ->end()
                        ->scalarNode('type')
                            ->info('Key type.')
                            ->cannotBeEmpty()
                            ->defaultValue(StaticKeyType::TYPE_NAME)
                        ->end()
                        ->scalarNode('method')
                            ->info('Generated key: generation method.')
                            ->cannotBeEmpty()
                            ->defaultValue('pbkdf2')
                        ->end()
                        ->scalarNode('hash_algorithm')
                            ->info('Generated key: hash algorithm.')
                            ->cannotBeEmpty()
                        ->end()
                        ->scalarNode('salt')
                            ->info('Generated key: salt.')
                            ->cannotBeEmpty()
                        ->end()
                        ->integerNode('cost')
                            ->info('Generated key: cost.')
                            ->min(1)
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $rootNode;
    }
public function addCryptoNode($type)
    {
        $nodeName = $type.'ion';

        $treeBuilder = new TreeBuilder($nodeName);

        $rootNode = $this->getRootNodeFromTreeBuilder($treeBuilder, $nodeName);

        $rootNode
            ->info('Configure '.$type.'er.')
            ->isRequired()
            ->fixXmlConfig('argument')
            ->children()
                ->scalarNode('service')
                    ->info('Symfony service name of '.$type.'er.')
                    ->isRequired()
                    ->cannotBeEmpty()
                ->end()
                ->arrayNode('key')
                    ->info(ucfirst($type).'ion key settings.')
                    ->beforeNormalization()
                        ->ifTrue(function ($v) {
                            return \is_string($v);
                        })
                        ->then(function ($v) {
                            return ['value' => $v];
                        })
                    ->end()
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('value')
                            ->info('Either the key or a password to use for key generation.')
                            ->defaultValue('')
                        ->end()
                        ->booleanNode('base64_encoded')
                            ->info('Key / password (value) is base64 encoded.')
                            ->defaultFalse()
                        ->end()
                        ->scalarNode('type')
                            ->info('Key type.')
                            ->cannotBeEmpty()
                            ->defaultValue(StaticKeyType::TYPE_NAME)
                        ->end()
                        ->scalarNode('method')
                            ->info('Generated key: generation method.')
                            ->cannotBeEmpty()
                            ->defaultValue('pbkdf2')
                        ->end()
                        ->scalarNode('hash_algorithm')
                            ->info('Generated key: hash algorithm.')
                            ->cannotBeEmpty()
                        ->end()
                        ->scalarNode('salt')
                            ->info('Generated key: salt.')
                            ->cannotBeEmpty()
                        ->end()
                        ->integerNode('cost')
                            ->info('Generated key: cost.')
                            ->min(1)
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $rootNode;
    }
public function addCryptoNode ( $ type ) { $ nodeName = $ type . 'ion' ; $ treeBuilder = new TreeBuilder ( $ nodeName ) ; $ rootNode = $ this -> getRootNodeFromTreeBuilder ( $ treeBuilder , $ nodeName ) ; $ rootNode -> info ( 'Configure ' . $ type . 'er.' ) -> isRequired ( ) -> fixXmlConfig ( 'argument' ) -> children ( ) -> scalarNode ( 'service' ) -> info ( 'Symfony service name of ' . $ type . 'er.' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> end ( ) -> arrayNode ( 'key' ) -> info ( ucfirst ( $ type ) . 'ion key settings.' ) -> beforeNormalization ( ) -> ifTrue ( function ( $ v ) { return \ is_string ( $ v ) ; } ) -> then ( function ( $ v ) { return [ 'value' => $ v ] ; } ) -> end ( ) -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'value' ) -> info ( 'Either the key or a password to use for key generation.' ) -> defaultValue ( '' ) -> end ( ) -> booleanNode ( 'base64_encoded' ) -> info ( 'Key / password (value) is base64 encoded.' ) -> defaultFalse ( ) -> end ( ) -> scalarNode ( 'type' ) -> info ( 'Key type.' ) -> cannotBeEmpty ( ) -> defaultValue ( StaticKeyType :: TYPE_NAME ) -> end ( ) -> scalarNode ( 'method' ) -> info ( 'Generated key: generation method.' ) -> cannotBeEmpty ( ) -> defaultValue ( 'pbkdf2' ) -> end ( ) -> scalarNode ( 'hash_algorithm' ) -> info ( 'Generated key: hash algorithm.' ) -> cannotBeEmpty ( ) -> end ( ) -> scalarNode ( 'salt' ) -> info ( 'Generated key: salt.' ) -> cannotBeEmpty ( ) -> end ( ) -> integerNode ( 'cost' ) -> info ( 'Generated key: cost.' ) -> min ( 1 ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) ; return $ rootNode ; }
Add crypto node.

@param string $type 'encrypt' or 'decrypt'

@return NodeDefinition
Add crypto node .