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 .actions .generation .util ;
6
7
7
8
import com .intellij .openapi .util .Key ;
10
11
import com .jetbrains .php .lang .psi .elements .Method ;
11
12
import com .jetbrains .php .lang .psi .elements .Parameter ;
12
13
import com .jetbrains .php .lang .psi .elements .PhpReturnType ;
13
- import com .magento .idea .magento2plugin .actions .generation .references .PhpClassReferenceResolver ;
14
14
import com .magento .idea .magento2plugin .actions .generation .data .code .PluginMethodData ;
15
- import org . jetbrains . annotations . NotNull ;
15
+ import com . magento . idea . magento2plugin . actions . generation . references . PhpClassReferenceResolver ;
16
16
import java .util .ArrayList ;
17
17
import java .util .Arrays ;
18
18
import java .util .Collection ;
19
19
import java .util .Set ;
20
+ import org .jetbrains .annotations .NotNull ;
20
21
21
22
public class FillTextBufferWithPluginMethods {
22
23
private static FillTextBufferWithPluginMethods INSTANCE = null ;
23
24
25
+ /**
26
+ * Get util instance.
27
+ *
28
+ * @return FillTextBufferWithPluginMethods
29
+ */
24
30
public static FillTextBufferWithPluginMethods getInstance () {
25
31
if (null == INSTANCE ) {
26
32
INSTANCE = new FillTextBufferWithPluginMethods ();
27
33
}
28
34
return INSTANCE ;
29
35
}
30
36
31
- public void execute (@ NotNull Key <Object > targetClassKey , Set <CharSequence > insertedMethodsNames , @ NotNull PhpClassReferenceResolver resolver , @ NotNull StringBuffer textBuf , @ NotNull PluginMethodData [] pluginMethods ) {
37
+ /**
38
+ * Fill text buffer with plugin methods.
39
+ *
40
+ * @param targetClassKey Key[Object]
41
+ * @param insertedMethodsNames Set[CharSequence]
42
+ * @param resolver PhpClassReferenceResolver
43
+ * @param textBuf StringBuffer
44
+ * @param pluginMethods PluginMethodData
45
+ */
46
+ public void execute (
47
+ final @ NotNull Key <Object > targetClassKey ,
48
+ final Set <CharSequence > insertedMethodsNames ,
49
+ final @ NotNull PhpClassReferenceResolver resolver ,
50
+ final @ NotNull StringBuffer textBuf ,
51
+ final @ NotNull PluginMethodData [] pluginMethods
52
+ ) {
32
53
for (PluginMethodData pluginMethod : pluginMethods ) {
33
54
insertedMethodsNames .add (pluginMethod .getMethod ().getName ());
34
55
PhpDocComment comment = pluginMethod .getDocComment ();
@@ -39,7 +60,8 @@ public void execute(@NotNull Key<Object> targetClassKey, Set<CharSequence> inser
39
60
Parameter [] parameters = targetMethod .getParameters ();
40
61
Collection <PsiElement > processElements = new ArrayList <>(Arrays .asList (parameters ));
41
62
resolver .processElements (processElements );
42
- PsiElement targetClass = (PsiElement ) pluginMethod .getTargetMethod ().getUserData (targetClassKey );
63
+ PsiElement targetClass = (PsiElement ) pluginMethod .getTargetMethod ()
64
+ .getUserData (targetClassKey );
43
65
resolver .processElement (targetClass );
44
66
PhpReturnType returnType = targetMethod .getReturnType ();
45
67
if (returnType != null ) {
0 commit comments