Skip to content

Commit 17f4106

Browse files
author
Dmitry Kologrivov
committed
MAGETWO-44227: add method setData
1 parent df9ced9 commit 17f4106

File tree

1 file changed

+10
-13
lines changed
  • lib/internal/Magento/Framework/Config

1 file changed

+10
-13
lines changed

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

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ public function __construct(
7171
*/
7272
public function getVars($module)
7373
{
74-
if ($this->data === null) {
75-
$this->data = $this->read();
76-
}
74+
$this->setData();
7775
return isset($this->data['vars'][$module]) ? $this->data['vars'][$module] : [];
7876
}
7977

@@ -86,9 +84,7 @@ public function getVars($module)
8684
*/
8785
public function getVarValue($module, $var)
8886
{
89-
if ($this->data === null) {
90-
$this->data = $this->read();
91-
}
87+
$this->setData();
9288
if (!isset($this->data['vars'][$module])) {
9389
return false;
9490
}
@@ -114,9 +110,7 @@ public function getVarValue($module, $var)
114110
*/
115111
public function getMediaEntities($module, $mediaType)
116112
{
117-
if ($this->data === null) {
118-
$this->data = $this->read();
119-
}
113+
$this->setData();
120114
return isset($this->data['media'][$module][$mediaType]) ? $this->data['media'][$module][$mediaType] : [];
121115
}
122116

@@ -130,9 +124,7 @@ public function getMediaEntities($module, $mediaType)
130124
*/
131125
public function getMediaAttributes($module, $mediaType, $mediaId)
132126
{
133-
if ($this->data === null) {
134-
$this->data = $this->read();
135-
}
127+
$this->setData();
136128
return isset($this->data['media'][$module][$mediaType][$mediaId])
137129
? $this->data['media'][$module][$mediaType][$mediaId]
138130
: [];
@@ -202,10 +194,15 @@ public function getExcludedDir()
202194
* @return array
203195
*/
204196
protected function getItems()
197+
{
198+
$this->setData();
199+
return isset($this->data['exclude']) ? $this->data['exclude'] : [];
200+
}
201+
202+
protected function setData()
205203
{
206204
if ($this->data === null) {
207205
$this->data = $this->read();
208206
}
209-
return isset($this->data['exclude']) ? $this->data['exclude'] : [];
210207
}
211208
}

0 commit comments

Comments
 (0)