Support multiple IPs for matching

This commit is contained in:
WouterJ 2013-06-24 22:26:23 +02:00 committed by Fabien Potencier
parent 99f97e59f1
commit cb5659afc0
3 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
2.4.0
-----
* allowed multiple IP addresses in profiler matcher settings
2.3.0
-----

View File

@ -149,13 +149,17 @@ class Configuration implements ConfigurationInterface
->arrayNode('matcher')
->canBeUnset()
->performNoDeepMerging()
->fixXmlConfig('ip')
->children()
->scalarNode('ip')->end()
->scalarNode('path')
->info('use the urldecoded format')
->example('^/path to resource/')
->end()
->scalarNode('service')->end()
->arrayNode('ips')
->beforeNormalization()->ifString()->then(function($v) { return array($v); })->end()
->prototype('scalar')->end()
->end()
->end()
->end()
->end()

View File

@ -241,7 +241,7 @@ class FrameworkExtension extends Extension
if (isset($config['matcher'])) {
if (isset($config['matcher']['service'])) {
$container->setAlias('profiler.request_matcher', $config['matcher']['service']);
} elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path'])) {
} elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path']) || isset($config['matcher']['ips'])) {
$definition = $container->register('profiler.request_matcher', 'Symfony\\Component\\HttpFoundation\\RequestMatcher');
$definition->setPublic(false);
@ -249,6 +249,10 @@ class FrameworkExtension extends Extension
$definition->addMethodCall('matchIp', array($config['matcher']['ip']));
}
if (isset($config['matcher']['ips'])) {
$definition->addMethodCall('matchIps', array($config['matcher']['ips']));
}
if (isset($config['matcher']['path'])) {
$definition->addMethodCall('matchPath', array($config['matcher']['path']));
}