Skip to content

Commit 8374386

Browse files
645: Code refactoring
1 parent 2492c26 commit 8374386

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/com/magento/idea/magento2plugin/stubs/indexes/js/RequireJsIndex.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,7 @@ private void parseConfigMap(
103103
if (mappingWrapper == null) {
104104
continue;
105105
}
106-
final JSProperty[] allConfigs = mappingWrapper.getProperties();
107-
108-
for (final JSProperty mapping : allConfigs) {
109-
final String nameConfig = mapping.getName();
110-
final JSExpression value = mapping.getValue();
111-
112-
if (value == null) {
113-
continue;
114-
}
115-
final String valueConfig = value.getText();
116-
map.put(nameConfig, valueConfig);
117-
}
106+
processObjectProperties(map, mappingWrapper.getProperties());
118107
}
119108
}
120109
}
@@ -136,18 +125,23 @@ private void parseConfigPaths(
136125
}
137126

138127
for (final JSObjectLiteralExpression pathGroupsWrapper : pathGroupsWrappers) {
139-
final JSProperty[] allConfigs = pathGroupsWrapper.getProperties();
128+
processObjectProperties(map, pathGroupsWrapper.getProperties());
129+
}
130+
}
140131

141-
for (final JSProperty mapping : allConfigs) {
142-
final String nameConfig = mapping.getName();
143-
final JSExpression value = mapping.getValue();
132+
private void processObjectProperties(
133+
final Map<String, String> map,
134+
final JSProperty... allConfigs
135+
) {
136+
for (final JSProperty mapping : allConfigs) {
137+
final String nameConfig = mapping.getName();
138+
final JSExpression value = mapping.getValue();
144139

145-
if (value == null) {
146-
continue;
147-
}
148-
final String valueConfig = value.getText();
149-
map.put(nameConfig, valueConfig);
140+
if (value == null) {
141+
continue;
150142
}
143+
final String valueConfig = value.getText();
144+
map.put(nameConfig, valueConfig);
151145
}
152146
}
153147

0 commit comments

Comments
 (0)