private function PhpDumper::addConstructor in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php \Symfony\Component\DependencyInjection\Dumper\PhpDumper::addConstructor()
Adds the constructor.
Return value
string
1 call to PhpDumper::addConstructor()
- 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 847
Class
- PhpDumper
- PhpDumper dumps a service container as a PHP class.
Namespace
Symfony\Component\DependencyInjection\DumperCode
private function addConstructor() {
$targetDirs = $this
->exportTargetDirs();
$arguments = $this->container
->getParameterBag()
->all() ? 'new ParameterBag($this->getDefaultParameters())' : null;
$code = <<<EOF
/**
* Constructor.
*/
public function __construct()
{{<span class="php-variable">$targetDirs</span>}
parent::__construct({<span class="php-variable">$arguments</span>});
EOF;
if (count($scopes = $this->container
->getScopes()) > 0) {
$code .= "\n";
$code .= " \$this->scopes = " . $this
->dumpValue($scopes) . ";\n";
$code .= " \$this->scopeChildren = " . $this
->dumpValue($this->container
->getScopeChildren()) . ";\n";
}
$code .= $this
->addMethodMap();
$code .= $this
->addAliases();
$code .= <<<EOF
}
EOF;
return $code;
}