Compiles the container.
This method passes the container to compiler passes whose job is to manipulate and optimize the container.
The main compiler passes roughly do four things:
@api
Overrides Container::compile
public function compile() {
if (null === $this->compiler) {
$this->compiler = new Compiler();
}
if ($this->trackResources) {
foreach ($this->compiler
->getPassConfig()
->getPasses() as $pass) {
$this
->addObjectResource($pass);
}
foreach ($this->definitions as $definition) {
if ($definition
->isLazy() && ($class = $definition
->getClass()) && class_exists($class)) {
$this
->addClassResource(new \ReflectionClass($class));
}
}
}
$this->compiler
->compile($this);
$this->extensionConfigs = array();
parent::compile();
}