New implementation of bundle

This commit is contained in:
Javier Hernández Gil
2014-03-31 00:20:02 +02:00
parent f01d7194fe
commit cae1a2f071
17 changed files with 619 additions and 199 deletions

View File

@@ -20,16 +20,28 @@ class Configuration implements ConfigurationInterface
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('jhg_nexmo');
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
$rootNode
->children()
->scalarNode('api_key')->end()
->scalarNode('api_secret')->end()
->scalarNode('from_name')->end()
->booleanNode('disable_delivery')->end()
->scalarNode('api_key')
->isRequired()
->end()
->scalarNode('api_secret')
->isRequired()
->end()
->scalarNode('from_name')
->validate()
->ifTrue(function ($s) {
return (strlen($s)>11 || strlen($s)<2) && preg_match('/^[0-9a-z]{11}$/i', $s) !== 1;
})
->thenInvalid('Invalid from_name, only alphanumeric characters are allowed')
->end()
->end()
->booleanNode('disable_delivery')
->defaultFalse()
->end()
->end()
;