66import com .jetbrains .php .lang .psi .elements .Method ;
77import com .jetbrains .php .lang .psi .elements .PhpClass ;
88import com .jetbrains .php .lang .psi .elements .PhpModifier ;
9+ import org .jetbrains .annotations .NotNull ;
910
1011import java .util .ArrayList ;
1112import java .util .List ;
@@ -15,18 +16,15 @@ abstract public class Filter {
1516 private boolean isMethodsAllowed = false ;
1617 private boolean isFieldsAllowed = false ;
1718
18- private List <String > allowedMethods ;
19- private List <String > allowedFields ;
20- private List <String > allowedModifiers ;
21- private List <String > disallowedMethods ;
19+ private List <String > allowedMethods = new ArrayList <String >();
20+ private List <String > allowedFields = new ArrayList <String >();
21+ private List <String > allowedModifiers = new ArrayList <String >();
22+ private List <String > disallowedMethods = new ArrayList <String >();
23+ private List <String > describedMethods = new ArrayList <String >();
2224
2325 private PhpClass phpClass ;
2426
2527 public Filter (FilterContext context ) {
26- allowedMethods = new ArrayList <String >();
27- allowedFields = new ArrayList <String >();
28- allowedModifiers = new ArrayList <String >();
29- disallowedMethods = new ArrayList <String >();
3028 }
3129
3230 public void allowMethod (String methodName ) {
@@ -41,6 +39,10 @@ public void disallowMethod(String methodName) {
4139 disallowedMethods .add (methodName );
4240 }
4341
42+ public void describeMethod (String methodName ) {
43+ describedMethods .add (methodName );
44+ }
45+
4446 public void allowField (String fieldName ) {
4547 allowFields ();
4648 allowedFields .add (fieldName );
@@ -70,6 +72,12 @@ public void disallowMethods(List<String> methodNames) {
7072 }
7173 }
7274
75+ public void describeMethods (List <String > methodNames ) {
76+ for (String methodName : methodNames ) {
77+ describeMethod (methodName );
78+ }
79+ }
80+
7381 public void allowFields () {
7482 isFieldsAllowed = true ;
7583 }
@@ -82,6 +90,14 @@ public boolean isMethodAllowed(Method method) {
8290 return !(method instanceof PhpDocMethod ) && isMethodAllowed (method .getName ()) && isModifierAllowed (method .getModifier ());
8391 }
8492
93+ public boolean isMethodDescribed (String methodName ) {
94+ return describedMethods .contains (methodName );
95+ }
96+
97+ public boolean isMethodDescribed (@ NotNull Method method ) {
98+ return isMethodDescribed (method .getName ());
99+ }
100+
85101 protected boolean isFieldAllowed (String fieldName ) {
86102 return isFieldsAllowed && (allowedFields .isEmpty () || allowedFields .contains (fieldName ));
87103 }
0 commit comments