You are here

public function PhpGeneratorDumper::dump in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php \Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper::dump()

Dumps a set of routes to a PHP class.

Available options:

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

Parameters

array $options An array of options:

Return value

string A PHP class representing the generator class

Overrides GeneratorDumperInterface::dump

File

vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php, line 34

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 Psr\\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>]}
{
    private static \$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;
}