Merge pull request #191 from odolbeau/feat-nodes

Allow multiple servers in configuration
This commit is contained in:
Richard Miller 2012-11-28 13:19:01 -08:00
commit 1bcc518b31

View file

@ -45,10 +45,41 @@ class Configuration
->useAttributeAsKey('id')
->prototype('array')
->performNoDeepMerging()
->beforeNormalization()
->ifTrue(function($v) { return isset($v['host']) && isset($v['port']); })
->then(function($v) {
return array(
'servers' => array(
'default' => array(
'host' => $v['host'],
'port' => $v['port'],
)
)
);
})
->end()
->beforeNormalization()
->ifTrue(function($v) { return isset($v['url']); })
->then(function($v) {
return array(
'servers' => array(
'default' => array(
'url' => $v['url'],
)
)
);
})
->end()
->children()
->scalarNode('url')->end()
->scalarNode('host')->end()
->scalarNode('port')->end()
->arrayNode('servers')
->prototype('array')
->children()
->scalarNode('url')->end()
->scalarNode('host')->end()
->scalarNode('port')->end()
->end()
->end()
->end()
->scalarNode('timeout')->end()
->scalarNode('headers')->end()
->end()