$this->
addTrace(sprintf('Path "%s" does not match',
$route->
getPath()), self::ROUTE_DOES_NOT_MATCH,
$name,
$route);
continue;
} $regex =
$compiledRoute->
getRegex();
$pos =
strrpos($regex, '$'
);
$hasTrailingSlash = '/' ===
$regex[$pos - 1
];
$regex =
substr_replace($regex, '/?$',
$pos -
$hasTrailingSlash, 1 +
$hasTrailingSlash);
if (!
preg_match($regex,
$pathinfo,
$matches)) { // does it match without any requirements?
$r =
new Route($route->
getPath(),
$route->
getDefaults(),
[],
$route->
getOptions());
$cr =
$r->
compile();
if (!
preg_match($cr->
getRegex(),
$pathinfo)) { $this->
addTrace(sprintf('Path "%s" does not match',
$route->
getPath()), self::ROUTE_DOES_NOT_MATCH,
$name,
$route);
continue;
} foreach ($route->
getRequirements() as $n =>
$regex) { $r =
new Route($route->
getPath(),
$route->
getDefaults(),
[$n =>
$regex],
$route->
getOptions());
$cr =
$r->
compile();