2
2
* Copyright © Magento, Inc. All rights reserved.
3
3
* See COPYING.txt for license details.
4
4
*/
5
+
5
6
package com .magento .idea .magento2plugin .indexes ;
6
7
7
8
import com .intellij .codeInsight .completion .PrefixMatcher ;
12
13
import com .intellij .psi .PsiReference ;
13
14
import com .intellij .psi .search .GlobalSearchScope ;
14
15
import com .intellij .psi .util .PsiTreeUtil ;
15
- import com .intellij .psi .xml .*;
16
+ // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
17
+ import com .intellij .psi .xml .*;//NOPMD
16
18
import com .intellij .util .indexing .FileBasedIndex ;
17
19
import com .jetbrains .php .PhpIndex ;
18
20
import com .jetbrains .php .lang .psi .elements .PhpClass ;
19
21
import com .magento .idea .magento2plugin .stubs .indexes .VirtualTypeIndex ;
20
22
import com .magento .idea .magento2plugin .util .xml .XmlPsiTreeUtil ;
21
- import org .jetbrains .annotations .NotNull ;
22
- import org .jetbrains .annotations .Nullable ;
23
-
23
+ // CHECKSTYLE IGNORE check FOR NEXT 1 LINES
24
24
import java .util .ArrayList ;
25
25
import java .util .Collection ;
26
26
import java .util .List ;
27
+ import org .jetbrains .annotations .NotNull ;
28
+ import org .jetbrains .annotations .Nullable ;
27
29
30
+ /**
31
+ * TODO: enable style checks after decomposition.
32
+ */
33
+ @ SuppressWarnings ({"PMD" , "checkstyle:all" })
28
34
public class DiIndex {
29
35
30
36
private static DiIndex INSTANCE ;
@@ -34,6 +40,12 @@ public class DiIndex {
34
40
private DiIndex () {
35
41
}
36
42
43
+ /**
44
+ * Get Instance.
45
+ *
46
+ * @param project
47
+ * @return DiIndex
48
+ */
37
49
public static DiIndex getInstance (final Project project ) {
38
50
if (null == INSTANCE ) {
39
51
INSTANCE = new DiIndex ();
@@ -42,6 +54,12 @@ public static DiIndex getInstance(final Project project) {
42
54
return INSTANCE ;
43
55
}
44
56
57
+ /**
58
+ * Get Php Class Of Argument.
59
+ *
60
+ * @param psiArgumentValueElement
61
+ * @return PhpClass
62
+ */
45
63
@ Nullable
46
64
public PhpClass getPhpClassOfArgument (XmlElement psiArgumentValueElement ) {
47
65
@@ -66,6 +84,12 @@ public PhpClass getPhpClassOfArgument(XmlElement psiArgumentValueElement) {
66
84
return null ;
67
85
}
68
86
87
+ /**
88
+ * Get Php Class Of Service Method.
89
+ *
90
+ * @param psiMethodValueElement
91
+ * @return PhpClass
92
+ */
69
93
@ Nullable
70
94
public static PhpClass getPhpClassOfServiceMethod (XmlElement psiMethodValueElement ) {
71
95
XmlTag serviceTag = PsiTreeUtil .getParentOfType (psiMethodValueElement , XmlTag .class );
@@ -95,6 +119,12 @@ public static PhpClass getPhpClassOfServiceMethod(XmlElement psiMethodValueEleme
95
119
return null ;
96
120
}
97
121
122
+ /**
123
+ * Get Php Class Of Job Method.
124
+ *
125
+ * @param psiMethodValueElement
126
+ * @return PhpClass
127
+ */
98
128
@ Nullable
99
129
public static PhpClass getPhpClassOfJobMethod (XmlElement psiMethodValueElement ) {
100
130
XmlTag serviceTag = PsiTreeUtil .getParentOfType (psiMethodValueElement , XmlTag .class );
@@ -124,6 +154,13 @@ public static PhpClass getPhpClassOfJobMethod(XmlElement psiMethodValueElement)
124
154
return null ;
125
155
}
126
156
157
+ /**
158
+ * Get Virtual Type Elements.
159
+ *
160
+ * @param name
161
+ * @param scope
162
+ * @return Collection<PsiElement>
163
+ */
127
164
public Collection <PsiElement > getVirtualTypeElements (final String name , final GlobalSearchScope scope ) {
128
165
Collection <PsiElement > result = new ArrayList <>();
129
166
@@ -141,6 +178,13 @@ public Collection<PsiElement> getVirtualTypeElements(final String name, final Gl
141
178
return result ;
142
179
}
143
180
181
+ /**
182
+ * Get All Virtual Type Element Names.
183
+ *
184
+ * @param prefixMatcher
185
+ * @param scope
186
+ * @return Collection<String>
187
+ */
144
188
public Collection <String > getAllVirtualTypeElementNames (PrefixMatcher prefixMatcher , final GlobalSearchScope scope ) {
145
189
Collection <String > keys =
146
190
FileBasedIndex .getInstance ().getAllKeys (VirtualTypeIndex .KEY , project );
@@ -149,6 +193,12 @@ public Collection<String> getAllVirtualTypeElementNames(PrefixMatcher prefixMatc
149
193
return keys ;
150
194
}
151
195
196
+ /**
197
+ * Get Top Type Of Virtual Type.
198
+ *
199
+ * @param name
200
+ * @return String
201
+ */
152
202
@ NotNull
153
203
private String getTopTypeOfVirtualType (@ NotNull String name ) {
154
204
List <String > values ;
0 commit comments