public function PhpGeneratorDumper::dump

Dumps a set of routes to a PHP class.

Available options:

  • class: The class name
  • base_class: The base class name

@api

Parameters

array $options An array of options:

Return value

string A PHP class representing the generator class

Overrides GeneratorDumperInterface::dump

File

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

Class

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

Namespace

Symfony\Component\Routing\Generator\Dumper

Code

public function dump(array $options = array()) {
  $options = array_merge(array(
    'class' => 'ProjectUrlGenerator',
    'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
  ), $options);
  return <<<EOF
<?php

use Symfony\\Component\\Routing\\RequestContext;
use Symfony\\Component\\Routing\\Exception\\RouteNotFoundException;
use Symfony\\Component\\HttpKernel\\Log\\LoggerInterface;

/**
 * {<span class="php-variable">$options</span>[<span class="php-string">'class'</span>]}
 *
 * This class has been auto-generated
 * by the Symfony Routing Component.
 */
class {<span class="php-variable">$options</span>[<span class="php-string">'class'</span>]} extends {<span class="php-variable">$options</span>[<span class="php-string">'base_class'</span>]}
{
    static private \$declaredRoutes = {<span class="php-variable">$this</span>
  -&gt;<span class="php-function-or-constant function member-of-self">generateDeclaredRoutes</span>()};

    /**
     * Constructor.
     */
    public function __construct(RequestContext \$context, LoggerInterface \$logger = null)
    {
        \$this->context = \$context;
        \$this->logger = \$logger;
    }

{<span class="php-variable">$this</span>
  -&gt;<span class="php-function-or-constant function member-of-self">generateGenerateMethod</span>()}
}

EOF;
}