You are here

private function PhpDumper::addFrozenConstructor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::addFrozenConstructor()

Adds the constructor for a frozen container.

Return value

string

1 call to PhpDumper::addFrozenConstructor()
PhpDumper::dump in vendor/symfony/dependency-injection/Dumper/PhpDumper.php
Dumps the service container as a PHP class.

File

vendor/symfony/dependency-injection/Dumper/PhpDumper.php, line 885

Class

PhpDumper
PhpDumper dumps a service container as a PHP class.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function addFrozenConstructor() {
  $targetDirs = $this
    ->exportTargetDirs();
  $code = <<<EOF

    /**
     * Constructor.
     */
    public function __construct()
    {{<span class="php-variable">$targetDirs</span>}
EOF;
  if ($this->container
    ->getParameterBag()
    ->all()) {
    $code .= "\n        \$this->parameters = \$this->getDefaultParameters();\n";
  }
  $code .= <<<EOF

        \$this->services =
        \$this->scopedServices =
        \$this->scopeStacks = array();
EOF;
  $code .= "\n";
  if (count($scopes = $this->container
    ->getScopes()) > 0) {
    $code .= '        $this->scopes = ' . $this
      ->dumpValue($scopes) . ";\n";
    $code .= '        $this->scopeChildren = ' . $this
      ->dumpValue($this->container
      ->getScopeChildren()) . ";\n";
  }
  else {
    $code .= "        \$this->scopes = array();\n";
    $code .= "        \$this->scopeChildren = array();\n";
  }
  $code .= $this
    ->addMethodMap();
  $code .= $this
    ->addAliases();
  $code .= <<<EOF
    }

EOF;
  return $code;
}