File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
main/java/fr/adrienbrault/idea/symfony2plugin/dic/container
test/java/fr/adrienbrault/idea/symfony2plugin/tests/dic Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,25 @@ public static XmlService createFromXml(@NotNull Element node) {
95
95
return null ;
96
96
}
97
97
98
+ // <service id="Psr\Log\LoggerInterface $securityLogger" alias="monolog.logger.security"/>
99
+ if (id .contains (" $" ) && id .matches ("^.*\\ s\\ $.*$" )) {
100
+ return null ;
101
+ }
102
+
103
+ if (id .startsWith ("." )) {
104
+ // <service id=".service_locator.XSes1R5" class="Symfony\Component\DependencyInjection\ServiceLocator" public="false">
105
+ // <service id=".service_locator.tHpW6v3" alias=".service_locator.Y7gDuDN" public="false"/>
106
+ if (id .startsWith (".service_locator" ) && id .matches ("^\\ .service_locator.*\\ .[\\ w_]+$" )) {
107
+ return null ;
108
+ }
109
+
110
+ // <service id=".2_~NpzP6Xn" public="false">
111
+ // <service id=".1_ArrayCache~kSL.YwK" class="Doctrine\Common\Cache\ArrayCache" public="false"/>
112
+ if (id .matches ("^\\ .[\\ w]+_.*\\ .[\\ w_]+$" ) || id .matches ("^\\ .[\\ w]+_~[\\ w_]+$" )) {
113
+ return null ;
114
+ }
115
+ }
116
+
98
117
XmlService xmlService = new XmlService (id );
99
118
100
119
String aClass = node .getAttribute ("class" );
@@ -103,7 +122,7 @@ public static XmlService createFromXml(@NotNull Element node) {
103
122
}
104
123
105
124
String isPublic = node .getAttribute ("public" );
106
- if (isPublic != null && "false" .equalsIgnoreCase (isPublic )) {
125
+ if ("false" .equalsIgnoreCase (isPublic )) {
107
126
xmlService .isPublic = false ;
108
127
}
109
128
Original file line number Diff line number Diff line change @@ -22,8 +22,13 @@ public void testParse() throws Exception {
22
22
"<container>" +
23
23
"<service id=\" adrienbrault\" class=\" AdrienBrault\\ Awesome\" />" +
24
24
"<service id=\" secret\" class=\" AdrienBrault\\ Secret\" public=\" false\" />" +
25
+ "<service id=\" .secret.test\" class=\" AdrienBrault\\ Secret\" public=\" false\" />" +
25
26
"<service id=\" translator\" alias=\" adrienbrault\" />" +
26
27
"<service id=\" translator_private\" alias=\" adrienbrault\" public=\" false\" />" +
28
+ "<service id=\" .service_locator.SFX6J7Y\" class=\" Symfony\\ Component\\ DependencyInjection\\ ServiceLocator\" public=\" false\" />" +
29
+ "<service id=\" Psr\\ Log\\ LoggerInterface $securityLogger\" alias=\" monolog.logger.security\" />" +
30
+ "<service id=\" .1_~NpzP6Xn\" public=\" false\" />" +
31
+ "<service id=\" .2_PhpArrayAdapter~kSL.YwK\" class=\" Symfony\\ Component\\ Cache\\ Adapter\\ PhpArrayAdapter\" public=\" false\" />" +
27
32
"</container>" ;
28
33
29
34
ServiceMap serviceMap = serviceMapParser .parse (new ByteArrayInputStream (xmlString .getBytes ()));
@@ -44,5 +49,12 @@ public void testParse() throws Exception {
44
49
assertFalse (
45
50
serviceMap .getServices ().stream ().filter (s -> "secret" .equals (s .getId ())).findFirst ().get ().isPublic ()
46
51
);
52
+
53
+ assertEquals (1 , serviceMap .getServices ().stream ().filter (s -> ".secret.test" .equals (s .getId ())).count ());
54
+
55
+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".service_locator.SFX6J7Y" .equals (s .getId ())).count ());
56
+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".service_locator.SFX6J7Y" .equals (s .getId ())).count ());
57
+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".1_~NpzP6Xn" .equals (s .getId ())).count ());
58
+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".2_PhpArrayAdapter~kSL.YwK" .equals (s .getId ())).count ());
47
59
}
48
60
}
You can’t perform that action at this time.
0 commit comments