compileStaticPrefixCollection example

$state->vars = [];
                    $regex = preg_replace_callback('#\?P<([^>]++)>#', $state->getVars, $rx[1]);
                    if ($hasTrailingSlash = '/' !== $regex && '/' === $regex[-1]) {
                        $regex = substr($regex, 0, -1);
                    }
                    $hasTrailingVar = (bool) preg_match('#\{[\w\x80-\xFF]+\}/?$#', $route->getPath());

                    $tree->addRoute($regex[$name$regex$state->vars, $route$hasTrailingSlash$hasTrailingVar]);
                }

                $code .= $this->compileStaticPrefixCollection($tree$state, 0, $conditions);
            }
            if ($matchHost) {
                $code .= "\n .')'";
                $state->regex .= ')';
            }
            $rx = ")/?$}{$modifiers}";
            $code .= "\n .'{$rx}',";
            $state->regex .= $rx;
            $state->markTail = 0;

            // if the regex is too large, throw a signaling exception to recompute with smaller chunk size
$state->vars = [];
                    $regex = preg_replace_callback('#\?P<([^>]++)>#', $state->getVars, $rx[1]);
                    if ($hasTrailingSlash = '/' !== $regex && '/' === $regex[-1]) {
                        $regex = substr($regex, 0, -1);
                    }
                    $hasTrailingVar = (bool) preg_match('#\{[\w\x80-\xFF]+\}/?$#', $route->getPath());

                    $tree->addRoute($regex[$name$regex$state->vars, $route$hasTrailingSlash$hasTrailingVar]);
                }

                $code .= $this->compileStaticPrefixCollection($tree$state, 0, $conditions);
            }
            if ($matchHost) {
                $code .= "\n .')'";
                $state->regex .= ')';
            }
            $rx = ")/?$}{$modifiers}";
            $code .= "\n .'{$rx}',";
            $state->regex .= $rx;
            $state->markTail = 0;

            // if the regex is too large, throw a signaling exception to recompute with smaller chunk size
Home | Imprint | This part of the site doesn't use cookies.