@@ -64,16 +64,19 @@ class Resolver implements ResolverInterface
6464 * @param string $defaultLocalePath
6565 * @param string $scopeType
6666 * @param mixed $locale
67+ * @param DeploymentConfig|null $deploymentConfig
6768 */
6869 public function __construct (
6970 ScopeConfigInterface $ scopeConfig ,
7071 $ defaultLocalePath ,
7172 $ scopeType ,
72- $ locale = null
73+ $ locale = null ,
74+ DeploymentConfig $ deploymentConfig = null
7375 ) {
7476 $ this ->scopeConfig = $ scopeConfig ;
7577 $ this ->defaultLocalePath = $ defaultLocalePath ;
7678 $ this ->scopeType = $ scopeType ;
79+ $ this ->deploymentConfig = $ deploymentConfig ?: ObjectManager::getInstance ()->create (DeploymentConfig::class);
7780 $ this ->setLocale ($ locale );
7881 }
7982
@@ -101,7 +104,7 @@ public function getDefaultLocale()
101104 {
102105 if (!$ this ->defaultLocale ) {
103106 $ locale = false ;
104- if ($ this ->getDeploymentConfig () ->isAvailable () && $ this ->getDeploymentConfig () ->isDbAvailable ()) {
107+ if ($ this ->deploymentConfig ->isAvailable () && $ this ->deploymentConfig ->isDbAvailable ()) {
105108 $ locale = $ this ->scopeConfig ->getValue ($ this ->getDefaultLocalePath (), $ this ->scopeType );
106109 }
107110 if (!$ locale ) {
@@ -169,18 +172,4 @@ public function revert()
169172 }
170173 return $ result ;
171174 }
172-
173- /**
174- * Retrieve Deployment Config
175- *
176- * @return DeploymentConfig
177- */
178- private function getDeploymentConfig ()
179- {
180- if (!$ this ->deploymentConfig ) {
181- $ this ->deploymentConfig = ObjectManager::getInstance ()->get (DeploymentConfig::class);
182- }
183-
184- return $ this ->deploymentConfig ;
185- }
186175}
0 commit comments