@@ -292,28 +292,7 @@ protected function _loadScopedData()
292
292
$ this ->_loadedScopes [$ scopeCode ] = true ;
293
293
}
294
294
} else {
295
- $ virtualTypes = [];
296
- foreach ($ this ->_scopePriorityScheme as $ scopeCode ) {
297
- if (false == isset ($ this ->_loadedScopes [$ scopeCode ])) {
298
- $ data = $ this ->_reader ->read ($ scopeCode ) ?: [];
299
- unset($ data ['preferences ' ]);
300
- if (count ($ data ) > 0 ) {
301
- $ this ->_inherited = [];
302
- $ this ->_processed = [];
303
- $ this ->merge ($ data );
304
- foreach ($ data as $ class => $ config ) {
305
- if (isset ($ config ['type ' ])) {
306
- $ virtualTypes [] = $ class ;
307
- }
308
- }
309
- }
310
- $ this ->_loadedScopes [$ scopeCode ] = true ;
311
- }
312
- if ($ this ->isCurrentScope ($ scopeCode )) {
313
- break ;
314
- }
315
- }
316
- foreach ($ virtualTypes as $ class ) {
295
+ foreach ($ this ->_loadScopedVirtualTypes () as $ class ) {
317
296
$ this ->_inheritPlugins ($ class );
318
297
}
319
298
foreach ($ this ->getClassDefinitions () as $ class ) {
@@ -328,6 +307,37 @@ protected function _loadScopedData()
328
307
}
329
308
}
330
309
310
+ /**
311
+ * Load virtual types for current scope
312
+ *
313
+ * @return array
314
+ */
315
+ private function _loadScopedVirtualTypes ()
316
+ {
317
+ $ virtualTypes = [];
318
+ foreach ($ this ->_scopePriorityScheme as $ scopeCode ) {
319
+ if (!isset ($ this ->_loadedScopes [$ scopeCode ])) {
320
+ $ data = $ this ->_reader ->read ($ scopeCode ) ?: [];
321
+ unset($ data ['preferences ' ]);
322
+ if (count ($ data ) > 0 ) {
323
+ $ this ->_inherited = [];
324
+ $ this ->_processed = [];
325
+ $ this ->merge ($ data );
326
+ foreach ($ data as $ class => $ config ) {
327
+ if (isset ($ config ['type ' ])) {
328
+ $ virtualTypes [] = $ class ;
329
+ }
330
+ }
331
+ }
332
+ $ this ->_loadedScopes [$ scopeCode ] = true ;
333
+ }
334
+ if ($ this ->isCurrentScope ($ scopeCode )) {
335
+ break ;
336
+ }
337
+ }
338
+ return $ virtualTypes ;
339
+ }
340
+
331
341
/**
332
342
* Whether scope code is current scope code
333
343
*
0 commit comments