[DependencyInjection] remove code duplication from ContainerBuilder
This commit is contained in:
parent
d1ef0f3fdd
commit
485fb15c91
@ -305,11 +305,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
*/
|
*/
|
||||||
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
|
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
|
||||||
{
|
{
|
||||||
if (null === $this->compiler) {
|
$this->getCompiler()->addPass($pass, $type);
|
||||||
$this->compiler = new Compiler();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->compiler->addPass($pass, $type);
|
|
||||||
|
|
||||||
$this->addObjectResource($pass);
|
$this->addObjectResource($pass);
|
||||||
|
|
||||||
@ -325,11 +321,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
*/
|
*/
|
||||||
public function getCompilerPassConfig()
|
public function getCompilerPassConfig()
|
||||||
{
|
{
|
||||||
if (null === $this->compiler) {
|
return $this->getCompiler()->getPassConfig();
|
||||||
$this->compiler = new Compiler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->compiler->getPassConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -610,12 +602,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
*/
|
*/
|
||||||
public function compile()
|
public function compile()
|
||||||
{
|
{
|
||||||
if (null === $this->compiler) {
|
$compiler = $this->getCompiler();
|
||||||
$this->compiler = new Compiler();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->trackResources) {
|
if ($this->trackResources) {
|
||||||
foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
|
foreach ($compiler->getPassConfig()->getPasses() as $pass) {
|
||||||
$this->addObjectResource($pass);
|
$this->addObjectResource($pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +616,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->compiler->compile($this);
|
$compiler->compile($this);
|
||||||
|
|
||||||
$this->extensionConfigs = array();
|
$this->extensionConfigs = array();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user