You are here

private function PhpDumper::startClass in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::startClass()

Adds the class headers.

Parameters

string $class Class name:

string $baseClass The name of the base class:

string $namespace The class namespace:

Return value

string

1 call to PhpDumper::startClass()
PhpDumper::dump in modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
Dumps the service container as a PHP class.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php, line 812

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function startClass($class, $baseClass, $namespace) {
  $bagClass = $this->container
    ->isFrozen() ? 'use Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag;' : 'use Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag;';
  $namespaceLine = $namespace ? "namespace {$namespace};\n" : '';
  return <<<EOF
<?php
{<span class="php-variable">$namespaceLine</span>}
use Symfony\\Component\\DependencyInjection\\ContainerInterface;
use Symfony\\Component\\DependencyInjection\\Container;
use Symfony\\Component\\DependencyInjection\\Exception\\InactiveScopeException;
use Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;
use Symfony\\Component\\DependencyInjection\\Exception\\LogicException;
use Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException;
{<span class="php-variable">$bagClass</span>}

/**
 * {<span class="php-variable">$class</span>}.
 *
 * This class has been auto-generated
 * by the Symfony Dependency Injection Component.
 */
class {<span class="php-variable">$class</span>} extends {<span class="php-variable">$baseClass</span>}
{
    private \$parameters;
    private \$targetDirs = array();

EOF;
}