protected function getRoutesByPath($path) { // Split the path up on the slashes, ignoring multiple slashes in a row
// or leading or trailing slashes. Convert to lower case here so we can
// have a case-insensitive match from the incoming path to the lower case
// pattern outlines from \Drupal\Core\Routing\RouteCompiler::compile().
// @see \Drupal\Core\Routing\CompiledRoute::__construct()
$parts =
preg_split('@/+@',
mb_strtolower($path), -1, PREG_SPLIT_NO_EMPTY
);
$collection =
new RouteCollection();
$ancestors =
$this->
getCandidateOutlines($parts);
if (empty($ancestors)) { return $collection;
} // The >= check on number_parts allows us to match routes with optional
// trailing wildcard parts as long as the pattern matches, since we
// dump the route pattern without those optional parts.
try { $routes =
$this->connection->
query("SELECT [name], [route], [fit] FROM {" .
$this->connection->
escapeTable($this->tableName
) . "} WHERE [pattern_outline] IN ( :patterns[] ) AND [number_parts] >= :count_parts",
[ ':patterns[]' =>
$ancestors,
':count_parts' =>
count($parts),
])