private function PhpGeneratorDumper::generateGenerateMethod

Generates PHP code representing the `generate` method that implements the UrlGeneratorInterface.

Return value

string PHP code

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php, line 109

Class

PhpGeneratorDumper
PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes.

Namespace

Symfony\Component\Routing\Generator\Dumper

Code

private function generateGenerateMethod() {
  return <<<EOF
    public function generate(\$name, \$parameters = array(), \$absolute = false)
    {
        if (!isset(self::\$declaredRoutes[\$name])) {
            throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', \$name));
        }

        list(\$variables, \$defaults, \$requirements, \$tokens) = self::\$declaredRoutes[\$name];

        return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$absolute);
    }
EOF;
}