private function PhpMatcherDumper::generateMatchMethod in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php \Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper::generateMatchMethod()
Generates the code for the match method implementing UrlMatcherInterface.
Parameters
bool $supportsRedirections Whether redirections are supported by the base class:
Return value
string Match method as PHP code
File
- vendor/
symfony/ routing/ Matcher/ Dumper/ PhpMatcherDumper.php, line 99
Class
- PhpMatcherDumper
- PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.
Namespace
Symfony\Component\Routing\Matcher\DumperCode
private function generateMatchMethod($supportsRedirections) {
$code = rtrim($this
->compileRoutes($this
->getRoutes(), $supportsRedirections), "\n");
return <<<EOF
public function match(\$pathinfo)
{
\$allow = array();
\$pathinfo = rawurldecode(\$pathinfo);
\$context = \$this->context;
\$request = \$this->request;
{<span class="php-variable">$code</span>}
throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException();
}
EOF;
}