当前位置: 首页>>代码示例>>Java>>正文


Java PhpClass.findMethodByName方法代码示例

本文整理汇总了Java中com.jetbrains.php.lang.psi.elements.PhpClass.findMethodByName方法的典型用法代码示例。如果您正苦于以下问题:Java PhpClass.findMethodByName方法的具体用法?Java PhpClass.findMethodByName怎么用?Java PhpClass.findMethodByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jetbrains.php.lang.psi.elements.PhpClass的用法示例。


在下文中一共展示了PhpClass.findMethodByName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExpectedMethods

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@NotNull
private Method[] getExpectedMethods(@NotNull Project project, @NotNull String ClassInterfaceName, @NotNull String methodName) {
    Set<Method> methods = new HashSet<>();

    for (PhpClass phpClass : PhpIndex.getInstance(project).getAnyByFQN(ClassInterfaceName)) {

        // handle constructor as string
        if(methodName.equalsIgnoreCase("__construct")) {
            Method constructor = phpClass.getConstructor();
            if(constructor != null) {
                methods.add(constructor);
            }
            continue;
        }

        Method method = phpClass.findMethodByName(methodName);
        if(method != null) {
            methods.add(method);
        }
    }
    
    return methods.toArray(new Method[methods.size()]);
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:24,代码来源:Symfony2InterfacesUtil.java

示例2: getClassMethod

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Nullable
static public Method getClassMethod(@NotNull Project project, @NotNull String phpClassName, @NotNull String methodName) {
    // we need here an each; because eg Command is non unique because of phar file
    for(PhpClass phpClass: PhpIndex.getInstance(project).getClassesByFQN(phpClassName)) {
        NeosProjectComponent.getLogger().debug(phpClass.getFQN());
        Method method = phpClass.findMethodByName(methodName);
        if(method != null) {
            return method;
        }
    }

    return null;
}
 
开发者ID:cvette,项目名称:intellij-neos,代码行数:14,代码来源:PhpElementsUtil.java

示例3: canShow

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Override
protected boolean canShow(PhpDocProperty property, PhpClass phpClass)
{
	String name = property.getName();
	String getter_methodName = "getter" + name.substring(0, 1).toUpperCase() + name.substring(1);
	String setter_methodName = "setter" + name.substring(0, 1).toUpperCase() + name.substring(1);
	Method getter_method = phpClass.findMethodByName(getter_methodName);
	Method setter_method = phpClass.findMethodByName(setter_methodName);
	return getter_method == null && setter_method == null;
}
 
开发者ID:nextras,项目名称:orm-intellij,代码行数:11,代码来源:GenerateGettersSettersAction.java

示例4: canShow

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Override
protected boolean canShow(PhpDocProperty property, PhpClass phpClass)
{
	String name = property.getName();
	String methodName = "setter" + name.substring(0, 1).toUpperCase() + name.substring(1);
	Method method = phpClass.findMethodByName(methodName);
	return method == null;
}
 
开发者ID:nextras,项目名称:orm-intellij,代码行数:9,代码来源:GenerateSettersAction.java

示例5: canShow

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Override
protected boolean canShow(PhpDocProperty property, PhpClass phpClass)
{
	String name = property.getName();
	String methodName = "getter" + name.substring(0, 1).toUpperCase() + name.substring(1);
	Method method = phpClass.findMethodByName(methodName);
	return method == null;
}
 
开发者ID:nextras,项目名称:orm-intellij,代码行数:9,代码来源:GenerateGettersAction.java

示例6: collectNavigationMarkers

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Override
protected void collectNavigationMarkers(@NotNull PsiElement element, Collection<? super RelatedItemLineMarkerInfo> result)
{
	if (!(element instanceof PhpDocMethod)) {
		return;
	}
	PhpDocMethod method = (PhpDocMethod) element;
	PhpClass containingClass = method.getContainingClass();
	PhpIndex index = PhpIndex.getInstance(method.getProject());
	if (!OrmUtils.OrmClass.REPOSITORY.is(containingClass, index)) {
		return;
	}
	if (baseMethods.contains(method.getName())) {
		return;
	}
	String repositoryClass = containingClass.getFQN();
	String mapperClass = repositoryClass.substring(0, repositoryClass.length() - 10) + "Mapper";


	PhpIndex phpIndex = PhpIndex.getInstance(element.getProject());
	Collection<Method> methods = new ArrayList<Method>();
	for (PhpClass cls : phpIndex.getClassesByFQN(mapperClass)) {
		if (!OrmUtils.OrmClass.MAPPER.is(cls, phpIndex)) {
			continue;
		}
		final Method mapperMethod = cls.findMethodByName(method.getName());
		if (mapperMethod == null) {
			continue;
		}
		methods.add(mapperMethod);
	}
	result.add(NavigationGutterIconBuilder.create(PhpIcons.METHOD)
		.setTargets(methods)
		.setTooltipText("Navigate to mapper method")
		.createLineMarkerInfo(method)
	);

}
 
开发者ID:nextras,项目名称:orm-intellij,代码行数:39,代码来源:RepositoryMapperMethodMarkerProvider.java

示例7: buildVisitor

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean isOnTheFly) {
    return new PhpElementVisitor() {
        @Override
        public void visitPhpMethodReference(MethodReference reference) {
            if (!ViewsUtil.isValidRenderMethod(reference)) {
                return;
            }

            if (ArrayUtil.contains(reference.getName(), ViewsUtil.renderMethods)) {
                if (reference.getParameters().length > 0) {
                    PsiElement pathParameter = reference.getParameters()[0];
                    if (pathParameter instanceof StringLiteralExpression) {
                        String path = ((StringLiteralExpression) pathParameter).getContents();
                        if (path.startsWith("//") || path.startsWith("@")) {
                            return;
                        }
                        PhpClass clazz = ClassUtils.getPhpClassByCallChain(reference);
                        if (clazz != null) {
                            Method method = clazz.findMethodByName("getViewPath");
                            PhpIndex phpIndex = PhpIndex.getInstance(reference.getProject());
                            if (method != null) {
                                PhpClass containingClass = method.getContainingClass();
                                PhpClass controllerBaseClass = ClassUtils.getClass(phpIndex, "yii\\base\\Controller");
                                PhpClass widgetBaseClass = ClassUtils.getClass(phpIndex, "yii\\base\\Widget");
                                if (containingClass != controllerBaseClass && containingClass != widgetBaseClass) {
                                    return;
                                }
                            }
                        }

                        PsiFile file = ViewsUtil.getViewFile(pathParameter);
                        if (file == null || !file.isValid()) {
                            final String errorViewNotFoundTemplate = "View file for \"%name%\" not found.";
                            final MissedViewLocalQuickFix quickFix = new MissedViewLocalQuickFix(path);
                            final String descriptionTemplate = errorViewNotFoundTemplate.replace("%name%", path);
                            final PsiElement stringPart = pathParameter.findElementAt(1);
                            if (stringPart != null) {
                                problemsHolder.registerProblem(stringPart, descriptionTemplate, quickFix);
                            }
                        }
                    }
                }
            }
        }
    };
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:49,代码来源:MissedViewInspection.java


注:本文中的com.jetbrains.php.lang.psi.elements.PhpClass.findMethodByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。