Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CompiledUrlMatcherDumper.php

function CompiledUrlMatcherDumper::compileStaticRoutes

Compiles static routes in a switch statement.

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.

Throws

\LogicException

1 call to CompiledUrlMatcherDumper::compileStaticRoutes()
CompiledUrlMatcherDumper::getCompiledRoutes in vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
Generates the arrays for CompiledUrlMatcher's constructor.

File

vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherDumper.php, line 212

Class

CompiledUrlMatcherDumper
CompiledUrlMatcherDumper creates PHP arrays to be used with CompiledUrlMatcher.

Namespace

Symfony\Component\Routing\Matcher\Dumper

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal