extract cached container decision

This commit is contained in:
Daniel Seifert 2024-04-25 13:29:58 +02:00
parent 1b2f3e0d0b
commit 6a07afeac4

View File

@ -152,13 +152,7 @@ class d3DicHandler implements d3DicHandlerInterface
startProfile(__METHOD__); startProfile(__METHOD__);
} }
$config = $this->d3GetConfig(); if ($this->d3UseCachedContainer()) {
if ($this->isNotInTest() &&
$config->isProductiveMode() &&
!$config->getConfigParam('iDebug') &&
$this->cacheFileExists()
) {
$container = $this->d3GetCacheContainer(); $container = $this->d3GetCacheContainer();
} else { } else {
$container = $this->getContainerBuilder(); $container = $this->getContainerBuilder();
@ -181,6 +175,16 @@ class d3DicHandler implements d3DicHandlerInterface
return $container; return $container;
} }
protected function d3UseCachedContainer(): bool
{
$config = $this->d3GetConfig();
return $config->isProductiveMode()
&& !$config->getConfigParam('iDebug')
&& $this->isNotInTest()
&& $this->cacheFileExists();
}
public function getContainerBuilder(): ContainerBuilder public function getContainerBuilder(): ContainerBuilder
{ {
return oxNew(ContainerBuilder::class); return oxNew(ContainerBuilder::class);