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

Breadcrumb

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

function CompiledUrlMatcherDumper::export

@internal

4 calls to CompiledUrlMatcherDumper::export()
CompiledUrlGeneratorDumper::generateDeclaredRoutes in vendor/symfony/routing/Generator/Dumper/CompiledUrlGeneratorDumper.php
Generates PHP code representing an array of defined routes together with the routes properties (e.g. requirements).
CompiledUrlMatcherDumper::compileDynamicRoutes in vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
Compiles a regular expression followed by a switch statement to match dynamic routes.
CompiledUrlMatcherDumper::compileStaticPrefixCollection in vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
Compiles a regexp tree of subpatterns that matches nested same-prefix routes.
CompiledUrlMatcherDumper::generateCompiledRoutes in vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherDumper.php

File

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

Class

CompiledUrlMatcherDumper
CompiledUrlMatcherDumper creates PHP arrays to be used with CompiledUrlMatcher.

Namespace

Symfony\Component\Routing\Matcher\Dumper

Code

public static function export(mixed $value) : string {
    if (null === $value) {
        return 'null';
    }
    if (!\is_array($value)) {
        if (\is_object($value)) {
            throw new \InvalidArgumentException('Symfony\\Component\\Routing\\Route cannot contain objects.');
        }
        return str_replace("\n", '\'."\\n".\'', var_export($value, true));
    }
    if (!$value) {
        return '[]';
    }
    $i = 0;
    $export = '[';
    foreach ($value as $k => $v) {
        if ($i === $k) {
            ++$i;
        }
        else {
            $export .= self::export($k) . ' => ';
            if (\is_int($k) && $i < $k) {
                $i = 1 + $k;
            }
        }
        $export .= self::export($v) . ', ';
    }
    return substr_replace($export, ']', -2);
}

API Navigation

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