[Routing] Fixed undefined variable + typo

This commit is contained in:
Pascal Borreli 2012-11-17 14:39:14 +00:00
parent 4ad1e14056
commit f7ea68f70c

View File

@ -47,16 +47,16 @@ class ApacheMatcherDumper extends MatcherDumper
$rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]"); $rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]");
$methodVars = array(); $methodVars = array();
$hostnameRegexUnique = 0; $hostnameRegexUnique = 0;
$prevHosnameRegex = ''; $prevHostnameRegex = '';
foreach ($this->getRoutes()->all() as $name => $route) { foreach ($this->getRoutes()->all() as $name => $route) {
$compiledRoute = $route->compile(); $compiledRoute = $route->compile();
$hostnameRegex = $compiledRoute->getHostnameRegex(); $hostnameRegex = $compiledRoute->getHostnameRegex();
if (null !== $hostnameRegex && $prevHosnameRegex !== $hostnameRegex) { if (null !== $hostnameRegex && $prevHostnameRegex !== $hostnameRegex) {
$prevHosnameRegex = $hostnameRegex; $prevHostnameRegex = $hostnameRegex;
$hostnameRegexUnique++; $hostnameRegexUnique++;
$rule = array(); $rule = array();
@ -217,7 +217,7 @@ class ApacheMatcherDumper extends MatcherDumper
$delimiter = $regex[0]; $delimiter = $regex[0];
$regexPatternEnd = strrpos($regex, $delimiter); $regexPatternEnd = strrpos($regex, $delimiter);
if (strlen($regex) < 2 || 0 === $regexPatternEnd) { if (strlen($regex) < 2 || 0 === $regexPatternEnd) {
throw new \LogicException('The "%s" route regex "%s" is invalid', $name, $regex); throw new \LogicException('The route regex "%s" is invalid', $regex);
} }
$regex = preg_replace('/\?<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1)); $regex = preg_replace('/\?<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1));