Optimizations

- Settings parameter in group method are no longer optional.
- Updated README to contain PHP JSON-extension under requirements.
- Updated composer.json to include php json extension.
This commit is contained in:
Simon Sessingø
2018-08-31 01:40:21 +02:00
parent 6bdfe06223
commit 0ac7fd559a
6 changed files with 161 additions and 80 deletions
+3 -5
View File
@@ -151,12 +151,10 @@ abstract class Route implements IRoute
/* If custom regex is defined, use that */
if (isset($this->where[$name]) === true) {
$regex = $this->where[$name];
} else if ($parameterRegex !== null) {
$regex = $parameterRegex;
} else {
if ($parameterRegex !== null) {
$regex = $parameterRegex;
} else {
$regex = $this->defaultParameterRegex ?? static::PARAMETERS_DEFAULT_REGEX;
}
$regex = $this->defaultParameterRegex ?? static::PARAMETERS_DEFAULT_REGEX;
}
$regex = sprintf('((\/|\-)(?P<%2$s>%3$s))%1$s', $parameters[2][$key], $name, $regex);