private function PhpGeneratorDumper::generateGenerateMethod in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php \Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper::generateGenerateMethod()
Generates PHP code representing the `generate` method that implements the UrlGeneratorInterface.
Return value
string PHP code
File
- vendor/
symfony/ routing/ Generator/ Dumper/ PhpGeneratorDumper.php, line 105
Class
- PhpGeneratorDumper
- PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes.
Namespace
Symfony\Component\Routing\Generator\DumperCode
private function generateGenerateMethod() {
return <<<EOF
public function generate(\$name, \$parameters = array(), \$referenceType = self::ABSOLUTE_PATH)
{
if (!isset(self::\$declaredRoutes[\$name])) {
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', \$name));
}
list(\$variables, \$defaults, \$requirements, \$tokens, \$hostTokens, \$requiredSchemes) = self::\$declaredRoutes[\$name];
return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$referenceType, \$hostTokens, \$requiredSchemes);
}
EOF;
}