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

Breadcrumb

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

function CompiledUrlMatcherDumper::generateCompiledRoutes

File

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

Class

CompiledUrlMatcherDumper
CompiledUrlMatcherDumper creates PHP arrays to be used with CompiledUrlMatcher.

Namespace

Symfony\Component\Routing\Matcher\Dumper

Code

private function generateCompiledRoutes() : string {
    [
        $matchHost,
        $staticRoutes,
        $regexpCode,
        $dynamicRoutes,
        $checkConditionCode,
    ] = $this->getCompiledRoutes(true);
    $code = self::export($matchHost) . ', // $matchHost' . "\n";
    $code .= '[ // $staticRoutes' . "\n";
    foreach ($staticRoutes as $path => $routes) {
        $code .= \sprintf("    %s => [\n", self::export($path));
        foreach ($routes as $route) {
            $code .= vsprintf("        [%s, %s, %s, %s, %s, %s, %s],\n", array_map([
                __CLASS__,
                'export',
            ], $route));
        }
        $code .= "    ],\n";
    }
    $code .= "],\n";
    $code .= \sprintf("[ // \$regexpList%s\n],\n", $regexpCode);
    $code .= '[ // $dynamicRoutes' . "\n";
    foreach ($dynamicRoutes as $path => $routes) {
        $code .= \sprintf("    %s => [\n", self::export($path));
        foreach ($routes as $route) {
            $code .= vsprintf("        [%s, %s, %s, %s, %s, %s, %s],\n", array_map([
                __CLASS__,
                'export',
            ], $route));
        }
        $code .= "    ],\n";
    }
    $code .= "],\n";
    $code = preg_replace('/ => \\[\\n        (\\[.+?),\\n    \\],/', ' => [$1],', $code);
    return $this->indent($code, 1) . $checkConditionCode;
}

API Navigation

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