@@ -204,6 +204,7 @@ public function __construct(ObjectManagerFactory $factory, $rootDir, array $init
204
204
$ this ->factory = $ factory ;
205
205
$ this ->rootDir = $ rootDir ;
206
206
$ this ->server = $ initParams ;
207
+ $ this ->objectManager = $ this ->factory ->create ($ this ->server );
207
208
}
208
209
209
210
/**
@@ -227,7 +228,6 @@ public function getParams()
227
228
public function createApplication ($ type , $ arguments = [])
228
229
{
229
230
try {
230
- $ this ->initObjectManager ();
231
231
$ application = $ this ->objectManager ->create ($ type , $ arguments );
232
232
if (!($ application instanceof AppInterface)) {
233
233
throw new \InvalidArgumentException ("The provided class doesn't implement AppInterface: {$ type }" );
@@ -250,7 +250,6 @@ public function run(AppInterface $application)
250
250
try {
251
251
\Magento \Framework \Profiler::start ('magento ' );
252
252
$ this ->initErrorHandler ();
253
- $ this ->initObjectManager ();
254
253
$ this ->assertMaintenance ();
255
254
$ this ->assertInstalled ();
256
255
$ response = $ application ->launch ();
@@ -279,7 +278,6 @@ protected function assertMaintenance()
279
278
if (null === $ isExpected ) {
280
279
return ;
281
280
}
282
- $ this ->initObjectManager ();
283
281
/** @var \Magento\Framework\App\MaintenanceMode $maintenance */
284
282
$ this ->maintenance = $ this ->objectManager ->get (\Magento \Framework \App \MaintenanceMode::class);
285
283
@@ -312,7 +310,6 @@ protected function assertInstalled()
312
310
if (null === $ isExpected ) {
313
311
return ;
314
312
}
315
- $ this ->initObjectManager ();
316
313
$ isInstalled = $ this ->isInstalled ();
317
314
if (!$ isInstalled && $ isExpected ) {
318
315
$ this ->errorCode = self ::ERR_IS_INSTALLED ;
@@ -351,7 +348,6 @@ private function getIsExpected($key, $default)
351
348
*/
352
349
private function isInstalled ()
353
350
{
354
- $ this ->initObjectManager ();
355
351
/** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
356
352
$ deploymentConfig = $ this ->objectManager ->get (\Magento \Framework \App \DeploymentConfig::class);
357
353
return $ deploymentConfig ->isAvailable ();
@@ -364,7 +360,6 @@ private function isInstalled()
364
360
*/
365
361
public function getObjectManager ()
366
362
{
367
- $ this ->initObjectManager ();
368
363
return $ this ->objectManager ;
369
364
}
370
365
@@ -378,20 +373,7 @@ private function initErrorHandler()
378
373
$ handler = new ErrorHandler ();
379
374
set_error_handler ([$ handler , 'handler ' ]);
380
375
}
381
-
382
- /**
383
- * Initializes object manager
384
- *
385
- * @return void
386
- */
387
- private function initObjectManager ()
388
- {
389
- if (!$ this ->objectManager ) {
390
- $ this ->objectManager = $ this ->factory ->create ($ this ->server );
391
- $ this ->maintenance = $ this ->objectManager ->get (\Magento \Framework \App \MaintenanceMode::class);
392
- }
393
- }
394
-
376
+
395
377
/**
396
378
* Getter for error code
397
379
*
0 commit comments