merged branch WouterJ/ips_profiler_matcher (PR #8352)

This PR was submitted for the 2.3 branch but it was merged into the master branch instead (closes #8352).

Discussion
----------

[Profiler] Support multiple IPs for matching

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | tbd

As matching by IPs is introduced in 2.3, I request this for that version too. Not sure if that's the way it should be done

Commits
-------

efa4892 [Profiler] Support multiple IPs for matching
This commit is contained in:
Fabien Potencier 2013-07-08 22:42:03 +02:00
commit ef7eb96773
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']));
}