From 6a07afeac47515dd229de0dfb46afbb09a5ddec3 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Thu, 25 Apr 2024 13:29:58 +0200 Subject: [PATCH] extract cached container decision --- d3DicHandler.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/d3DicHandler.php b/d3DicHandler.php index b5667ac..93c7685 100644 --- a/d3DicHandler.php +++ b/d3DicHandler.php @@ -152,13 +152,7 @@ class d3DicHandler implements d3DicHandlerInterface startProfile(__METHOD__); } - $config = $this->d3GetConfig(); - - if ($this->isNotInTest() && - $config->isProductiveMode() && - !$config->getConfigParam('iDebug') && - $this->cacheFileExists() - ) { + if ($this->d3UseCachedContainer()) { $container = $this->d3GetCacheContainer(); } else { $container = $this->getContainerBuilder(); @@ -181,6 +175,16 @@ class d3DicHandler implements d3DicHandlerInterface return $container; } + protected function d3UseCachedContainer(): bool + { + $config = $this->d3GetConfig(); + + return $config->isProductiveMode() + && !$config->getConfigParam('iDebug') + && $this->isNotInTest() + && $this->cacheFileExists(); + } + public function getContainerBuilder(): ContainerBuilder { return oxNew(ContainerBuilder::class);