Skip to content

Commit bd0ac95

Browse files
committed
use return values for convertIndexToService, for cache preparation
1 parent 0502b4d commit bd0ac95

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/fr/adrienbrault/idea/symfony2plugin/stubs/ContainerCollectionResolver.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public Map<String, ContainerService> getServices() {
137137
return this.services;
138138
}
139139

140-
this.services = new HashMap<String, ContainerService>();
140+
this.services = new HashMap<String, ContainerService>();
141141

142142
if(this.sources.contains(Source.COMPILER)) {
143143
for(Map.Entry<String, String> entry: ServiceXmlParserFactory.getInstance(project, XmlServiceParser.class).getServiceMap().getMap().entrySet()) {
@@ -159,7 +159,7 @@ public Map<String, ContainerService> getServices() {
159159
if(serviceDefinitions.size() == 0) {
160160
this.services.put(serviceName, new ContainerService(serviceName, null, true));
161161
} else {
162-
convertIndexToService(serviceName, serviceDefinitions);
162+
this.services.putAll(convertIndexToService(serviceName, serviceDefinitions));
163163
}
164164

165165

@@ -172,14 +172,17 @@ public Map<String, ContainerService> getServices() {
172172
return this.services;
173173
}
174174

175-
private void convertIndexToService(String serviceName, List<String[]> serviceDefinitions) {
175+
private Map<String, ContainerService> convertIndexToService(String serviceName, List<String[]> serviceDefinitions) {
176+
177+
Map<String, ContainerService> serviceMap = new HashMap<String, ContainerService>();
178+
176179
for(String[] serviceDefinitionArray: serviceDefinitions) {
177180

178181
// 0: class name
179182
// 1: private: (String) "true" if presented
180183
if(serviceDefinitionArray.length == 0) {
181184
// just a fallback should not happen, but provide at least a service name
182-
this.services.put(serviceName, new ContainerService(serviceName, null, true));
185+
serviceMap.put(serviceName, new ContainerService(serviceName, null, true));
183186
} else {
184187

185188
// resolve class value, it can be null or a parameter
@@ -189,16 +192,18 @@ private void convertIndexToService(String serviceName, List<String[]> serviceDef
189192
}
190193

191194
if(serviceDefinitionArray.length == 1) {
192-
this.services.put(serviceName, new ContainerService(serviceName, classValue, true));
195+
serviceMap.put(serviceName, new ContainerService(serviceName, classValue, true));
193196
}
194197

195198
if(serviceDefinitionArray.length == 2) {
196-
this.services.put(serviceName, new ContainerService(serviceName, classValue, true, "true".equals(serviceDefinitionArray[1])));
199+
serviceMap.put(serviceName, new ContainerService(serviceName, classValue, true, "true".equals(serviceDefinitionArray[1])));
197200
}
198201

199202
}
200203

201204
}
205+
206+
return serviceMap;
202207
}
203208

204209
public Set<String> convertClassNameToServices(@NotNull String fqnClassName) {

0 commit comments

Comments
 (0)