[Routing] small refactoring in Router
This commit is contained in:
parent
9f4525a614
commit
dd0403f117
@ -83,17 +83,15 @@ class Router implements RouterInterface
|
|||||||
|
|
||||||
// check option names and live merge, if errors are encountered Exception will be thrown
|
// check option names and live merge, if errors are encountered Exception will be thrown
|
||||||
$invalid = array();
|
$invalid = array();
|
||||||
$isInvalid = false;
|
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
if (array_key_exists($key, $this->options)) {
|
if (array_key_exists($key, $this->options)) {
|
||||||
$this->options[$key] = $value;
|
$this->options[$key] = $value;
|
||||||
} else {
|
} else {
|
||||||
$isInvalid = true;
|
|
||||||
$invalid[] = $key;
|
$invalid[] = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isInvalid) {
|
if ($invalid) {
|
||||||
throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('\', \'', $invalid)));
|
throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('\', \'', $invalid)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user