private function PhpGeneratorDumper::generateDeclaredRoutes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php \Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper::generateDeclaredRoutes()
Generates PHP code representing an array of defined routes together with the routes properties (e.g. requirements).
Return value
string PHP code
File
- vendor/
symfony/ routing/ Generator/ Dumper/ PhpGeneratorDumper.php, line 79
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 generateDeclaredRoutes() {
$routes = "array(\n";
foreach ($this
->getRoutes()
->all() as $name => $route) {
$compiledRoute = $route
->compile();
$properties = array();
$properties[] = $compiledRoute
->getVariables();
$properties[] = $route
->getDefaults();
$properties[] = $route
->getRequirements();
$properties[] = $compiledRoute
->getTokens();
$properties[] = $compiledRoute
->getHostTokens();
$properties[] = $route
->getSchemes();
$routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true)));
}
$routes .= ' )';
return $routes;
}