private function compileStaticRoutes(array
$staticRoutes, array &
$conditions): array
{ if (!
$staticRoutes) { return [];
} $compiledRoutes =
[];
foreach ($staticRoutes as $url =>
$routes) { $compiledRoutes[$url] =
[];
foreach ($routes as $name =>
[$route,
$hasTrailingSlash]) { $compiledRoutes[$url][] =
$this->
compileRoute($route,
$name,
(!
$route->
compile()->
getHostVariables() ?
$route->
getHost() :
$route->
compile()->
getHostRegex()) ?: null,
$hasTrailingSlash, false,
$conditions);
} } return $compiledRoutes;
} /**
* Compiles a regular expression followed by a switch statement to match dynamic routes.
*
* The regular expression matches both the host and the pathinfo at the same time. For stellar performance,
* it is built as a tree of patterns, with re-ordering logic to group same-prefix routes together when possible.
*
* Patterns are named so that we know which one matched (https://pcre.org/current/doc/html/pcre2syntax.html#SEC23).
* This name is used to "switch" to the additional logic required to match the final route.
*
* Condition-less paths are put in a static array in the switch's default, with generic matching logic.
* Paths that can match two or more routes, or have user-specified conditions are put in separate switch's cases.
*
* Last but not least:
* - Because it is not possible to mix unicode/non-unicode patterns in a single regexp, several of them can be generated.
* - The same regexp can be used several times when the logic in the switch rejects the match. When this happens, the
* matching-but-failing subpattern is excluded by replacing its name by "(*F)", which forces a failure-to-match.
* To ease this backlisting operation, the name of subpatterns is also the string offset where the replacement should occur.
*/