5
5
*/
6
6
namespace Magento \Framework \Config ;
7
7
8
- use Magento \Framework \App \Cache \Type \Layout as LayoutCache ;
9
- use Magento \Framework \App \ObjectManager ;
10
- use Magento \Framework \Serialize \SerializerInterface ;
11
- use Magento \Framework \Serialize \Serializer \Json ;
12
- use Magento \Framework \View \DesignInterface ;
13
-
14
8
/**
15
9
* View configuration files handler
16
10
*
@@ -30,26 +24,6 @@ class View extends \Magento\Framework\Config\Reader\Filesystem
30
24
*/
31
25
protected $ data ;
32
26
33
- /**
34
- * @var LayoutCache
35
- */
36
- private $ layoutCache ;
37
-
38
- /**
39
- * @var SerializerInterface
40
- */
41
- private $ serializer ;
42
-
43
- /**
44
- * @var array
45
- */
46
- private $ scopedLayoutCache ;
47
-
48
- /**
49
- * @var DesignInterface
50
- */
51
- private $ design ;
52
-
53
27
/**
54
28
* @param FileResolverInterface $fileResolver
55
29
* @param ConverterInterface $converter
@@ -60,10 +34,6 @@ class View extends \Magento\Framework\Config\Reader\Filesystem
60
34
* @param string $domDocumentClass
61
35
* @param string $defaultScope
62
36
* @param array $xpath
63
- * @param LayoutCache|null $layoutCache
64
- * @param SerializerInterface|null $serializer
65
- * @param DesignInterface|null $design
66
- * @SuppressWarnings(PHPMD.ExcessiveParameterList)
67
37
*/
68
38
public function __construct (
69
39
FileResolverInterface $ fileResolver ,
@@ -74,14 +44,10 @@ public function __construct(
74
44
$ idAttributes = [],
75
45
$ domDocumentClass = \Magento \Framework \Config \Dom::class,
76
46
$ defaultScope = 'global ' ,
77
- $ xpath = [],
78
- LayoutCache $ layoutCache = null ,
79
- SerializerInterface $ serializer = null ,
80
- DesignInterface $ design = null
47
+ $ xpath = []
81
48
) {
82
49
$ this ->xpath = $ xpath ;
83
50
$ idAttributes = $ this ->getIdAttributes ();
84
-
85
51
parent ::__construct (
86
52
$ fileResolver ,
87
53
$ converter ,
@@ -92,9 +58,6 @@ public function __construct(
92
58
$ domDocumentClass ,
93
59
$ defaultScope
94
60
);
95
- $ this ->layoutCache = $ layoutCache ?? ObjectManager::getInstance ()->get (LayoutCache::class);
96
- $ this ->serializer = $ serializer ?? ObjectManager::getInstance ()->get (Json::class);
97
- $ this ->design = $ design ?? ObjectManager::getInstance ()->get (DesignInterface::class);
98
61
}
99
62
100
63
/**
@@ -236,45 +199,22 @@ protected function initData()
236
199
}
237
200
238
201
/**
239
- * @inheritdoc
240
- *
241
- * @throws \InvalidArgumentException
202
+ * {@inheritdoc}
242
203
* @since 100.1.0
243
204
*/
244
205
public function read ($ scope = null )
245
206
{
246
207
$ scope = $ scope ?: $ this ->_defaultScope ;
247
- $ layoutCacheKey = implode (
248
- '- ' ,
249
- [
250
- __CLASS__ ,
251
- $ scope ,
252
- $ this ->_fileName ,
253
- $ this ->design ->getArea (),
254
- $ this ->serializer ->serialize ($ this ->xpath )
255
- ]
256
- );
257
- if (!isset ($ this ->scopedLayoutCache [$ layoutCacheKey ])) {
258
- if ($ data = $ this ->layoutCache ->load ($ layoutCacheKey )) {
259
- $ this ->scopedLayoutCache [$ layoutCacheKey ] = $ this ->serializer ->unserialize ($ data );
260
- } else {
261
- $ result = [];
262
-
263
- $ parents = (array )$ this ->_fileResolver ->getParents ($ this ->_fileName , $ scope );
264
- // Sort parents desc
265
- krsort ($ parents );
208
+ $ result = [];
266
209
267
- foreach ( $ parents as $ parent ) {
268
- $ result = array_replace_recursive ( $ result , $ this -> _readFiles ([ $ parent ]));
269
- }
210
+ $ parents = ( array ) $ this -> _fileResolver -> getParents ( $ this -> _fileName , $ scope );
211
+ // Sort parents desc
212
+ krsort ( $ parents );
270
213
271
- $ this ->scopedLayoutCache [$ layoutCacheKey ] = array_replace_recursive ($ result , parent ::read ($ scope ));
272
- $ this ->layoutCache ->save (
273
- $ this ->serializer ->serialize ($ this ->scopedLayoutCache [$ layoutCacheKey ]),
274
- $ layoutCacheKey
275
- );
276
- }
214
+ foreach ($ parents as $ parent ) {
215
+ $ result = array_replace_recursive ($ result , $ this ->_readFiles ([$ parent ]));
277
216
}
278
- return $ this ->scopedLayoutCache [$ layoutCacheKey ];
217
+
218
+ return array_replace_recursive ($ result , parent ::read ($ scope ));
279
219
}
280
220
}
0 commit comments