@@ -64,16 +64,19 @@ class Resolver implements ResolverInterface
64
64
* @param string $defaultLocalePath
65
65
* @param string $scopeType
66
66
* @param mixed $locale
67
+ * @param DeploymentConfig|null $deploymentConfig
67
68
*/
68
69
public function __construct (
69
70
ScopeConfigInterface $ scopeConfig ,
70
71
$ defaultLocalePath ,
71
72
$ scopeType ,
72
- $ locale = null
73
+ $ locale = null ,
74
+ DeploymentConfig $ deploymentConfig = null
73
75
) {
74
76
$ this ->scopeConfig = $ scopeConfig ;
75
77
$ this ->defaultLocalePath = $ defaultLocalePath ;
76
78
$ this ->scopeType = $ scopeType ;
79
+ $ this ->deploymentConfig = $ deploymentConfig ?: ObjectManager::getInstance ()->create (DeploymentConfig::class);
77
80
$ this ->setLocale ($ locale );
78
81
}
79
82
@@ -101,7 +104,7 @@ public function getDefaultLocale()
101
104
{
102
105
if (!$ this ->defaultLocale ) {
103
106
$ locale = false ;
104
- if ($ this ->getDeploymentConfig () ->isAvailable () && $ this ->getDeploymentConfig () ->isDbAvailable ()) {
107
+ if ($ this ->deploymentConfig ->isAvailable () && $ this ->deploymentConfig ->isDbAvailable ()) {
105
108
$ locale = $ this ->scopeConfig ->getValue ($ this ->getDefaultLocalePath (), $ this ->scopeType );
106
109
}
107
110
if (!$ locale ) {
@@ -169,18 +172,4 @@ public function revert()
169
172
}
170
173
return $ result ;
171
174
}
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
- }
186
175
}
0 commit comments