Skip to content

Commit 0f9cf6a

Browse files
committed
MAGETWO-62486: Refactor Layout to store data from object only and restore object
- change code style
1 parent a63c121 commit 0f9cf6a

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

lib/internal/Magento/Framework/View/Layout/ScheduledStructure.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ public function flushScheduledStructure()
542542
}
543543

544544
/**
545-
* Reformat layout scheduled structure to array.
546-
* It can be possible for serialization and save to cache storage for example.
545+
* Reformat 'Layout scheduled structure' to array.
547546
*
548547
* @return array
549548
*/
@@ -558,28 +557,27 @@ public function __toArray()
558557
}
559558

560559
/**
561-
* Update layout scheduled structure data.
562-
* It can be used for case of set data from cache storage after initialization this class.
560+
* Update 'Layout scheduled structure' data.
563561
*
564562
* @param array $data
565563
* @return void
566564
*/
567565
public function populateWithArray(array $data)
568566
{
569567
foreach ($this->serializableProperties as $property) {
570-
$this->{$property} = $this->getDataValue($property, $data);
568+
$this->{$property} = $this->getArrayValueByKey($property, $data);
571569
}
572570
}
573571

574572
/**
575573
* Get value from array by key.
576574
*
577-
* @param string $name
578-
* @param array $data
575+
* @param string $key
576+
* @param array $array
579577
* @return array
580578
*/
581-
private function getDataValue($name, array $data)
579+
private function getArrayValueByKey($key, array $array)
582580
{
583-
return isset($data[$name]) ? $data[$name] : [];
581+
return isset($array[$key]) ? $array[$key] : [];
584582
}
585583
}

lib/internal/Magento/Framework/View/Page/Config/Structure.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ public function getAssets()
212212
}
213213

214214
/**
215-
* Reformat page config structure to array.
216-
* It can be possible for serialization and save to cache storage for example.
215+
* Reformat 'Page config structure' to array.
217216
*
218217
* @return array
219218
*/
@@ -228,28 +227,27 @@ public function __toArray()
228227
}
229228

230229
/**
231-
* Update page config structure data.
232-
* It can be used for case of set data from cache storage after initialization this class.
230+
* Update 'Page config structure' data.
233231
*
234232
* @param array $data
235233
* @return void
236234
*/
237235
public function populateWithArray(array $data)
238236
{
239237
foreach ($this->serializableProperties as $property) {
240-
$this->{$property} = $this->getDataValue($property, $data);
238+
$this->{$property} = $this->getArrayValueByKey($property, $data);
241239
}
242240
}
243241

244242
/**
245243
* Get value from array by key.
246244
*
247-
* @param string $name
248-
* @param array $data
245+
* @param string $key
246+
* @param array $array
249247
* @return array
250248
*/
251-
private function getDataValue($name, array $data)
249+
private function getArrayValueByKey($key, array $array)
252250
{
253-
return isset($data[$name]) ? $data[$name] : [];
251+
return isset($array[$key]) ? $array[$key] : [];
254252
}
255253
}

0 commit comments

Comments
 (0)