Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions src/Symfony/Component/DependencyInjection/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
protected $injectors = array();
protected $compiler;

/**
* Constructor.
*
* @param ParameterBagInterface $parameterBag
*/
public function __construct(ParameterBagInterface $parameterBag = null)
{
parent::__construct($parameterBag);

$this->compiler = new Compiler();
}

/**
* Registers an extension.
*
Expand Down Expand Up @@ -175,6 +163,10 @@ public function loadFromExtension($extension, array $values = array())
*/
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
{
if (null === $this->compiler) {
$this->compiler = new Compiler();
}

$this->compiler->addPass($pass, $type);

$this->addObjectResource($pass);
Expand All @@ -187,6 +179,10 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig:
*/
public function getCompilerPassConfig()
{
if (null === $this->compiler) {
$this->compiler = new Compiler();
}

return $this->compiler->getPassConfig();
}

Expand All @@ -197,6 +193,10 @@ public function getCompilerPassConfig()
*/
public function getCompiler()
{
if (null === $this->compiler) {
$this->compiler = new Compiler();
}

return $this->compiler;
}

Expand Down Expand Up @@ -391,6 +391,10 @@ public function getExtensionConfig($name)
*/
public function compile()
{
if (null === $this->compiler) {
$this->compiler = new Compiler();
}

foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
$this->addObjectResource($pass);
}
Expand Down