Development

- Fixed issue with subdomains on groups.
- Fixed issue with loadble routes sometimes mistakenly inheriting wrong group.
- Routes will now check if group matches before matching any custom regex.
- Added setValue method to IInputItem class to streamline the InputFile and InputItem classes.
- Other minor optimisations.
- Documentation: fixed broken links and cleaned it up.
This commit is contained in:
Simon Sessingo
2018-03-03 23:37:14 +01:00
parent be39010be3
commit d279d5598d
12 changed files with 125 additions and 94 deletions
+7 -5
View File
@@ -128,7 +128,9 @@ abstract class Route implements IRoute
// Ensures that hostnames/domains will work with parameters
$url = '/' . ltrim($url, '/');
if (preg_match_all('/' . $regex . '/u', $route, $parameters) !== 0) {
if ((bool)preg_match_all('/' . $regex . '/u', $route, $parameters) === false) {
$urlRegex = preg_quote($route, '/');
} else {
$urlParts = preg_split('/((\-?\/?)\{[^}]+\})/', $route);
@@ -154,7 +156,6 @@ abstract class Route implements IRoute
}
$regex = sprintf('(?:\/|\-)%1$s(?P<%2$s>%3$s)%1$s', $parameters[2][$key], $name, $regex);
}
$urlParts[$key] = preg_quote($t, '/') . $regex;
@@ -162,11 +163,9 @@ abstract class Route implements IRoute
$urlRegex = implode('', $urlParts);
} else {
$urlRegex = preg_quote($route, '/');
}
if (preg_match(sprintf($this->urlRegex, $urlRegex), $url, $matches) === 0) {
if ((bool)preg_match(sprintf($this->urlRegex, $urlRegex), $url, $matches) === false) {
return null;
}
@@ -250,6 +249,9 @@ abstract class Route implements IRoute
{
$this->group = $group;
/* Add/merge parent settings with child */
$this->setSettings($group->toArray(), true);
return $this;
}