Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
Allow use of all the RequestMatcher parameters by providing an array
Browse files Browse the repository at this point in the history
  • Loading branch information
quazardous authored and fabpot committed Mar 10, 2016
1 parent 5a7a491 commit 9698b77
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Silex/Provider/SecurityServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,17 @@ public function register(Container $app)
foreach ($app['security.access_rules'] as $rule) {
if (is_string($rule[0])) {
$rule[0] = new RequestMatcher($rule[0]);
} elseif (is_array($rule[0])) {
$rule[0] += [
'path' => null,
'host' => null,
'methods' => null,
'ips' => null,
'attributes' => null,
'schemes' => null,
];
$rule[0] = new RequestMatcher($rule[0]['path'], $rule[0]['host'], $rule[0]['methods'], $rule[0]['ips'], $rule[0]['attributes'], $rule[0]['schemes']);
}

$map->add($rule[0], (array) $rule[1], isset($rule[2]) ? $rule[2] : null);
}

Expand Down

0 comments on commit 9698b77

Please sign in to comment.