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


Java PhpClass.getMethods方法代码示例

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


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

示例1: addCompletions

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
                              ProcessingContext context,
                              @NotNull CompletionResultSet result) {
    PsiElement position = parameters.getPosition().getOriginalElement();
    if (position == null) {
        return;
    }

    PhpClass phpClass = DiIndex.getPhpClassOfServiceMethod((XmlElement) position);
    if (phpClass != null) {
        for (Method method : phpClass.getMethods()) {
            result.addElement(
                    LookupElementBuilder
                            .create(method.getName())
                            .withIcon(method.getIcon())
            );
        }
    }
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:21,代码来源:PhpServiceMethodCompletionContributor.java

示例2: extractRoutesForMethod

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
/**
 * Get list of Web API routes related to the specified method.
 * <p/>
 * Web API declarations for parent classes are taken into account.
 * Results are not cached.
 */
List<XmlTag> extractRoutesForMethod(@NotNull Method method) {
    List<XmlTag> routesForMethod = WebApiTypeIndex.getWebApiRoutes(method);
    PhpClass phpClass = method.getContainingClass();
    if (phpClass == null) {
        return routesForMethod;
    }
    for (PhpClass parent : method.getContainingClass().getSupers()) {
        for (Method parentMethod : parent.getMethods()) {
            if (parentMethod.getName().equals(method.getName())) {
                routesForMethod.addAll(extractRoutesForMethod(parentMethod));
            }
        }
    }
    return routesForMethod;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:22,代码来源:WebApiLineMarkerProvider.java

示例3: getReferencesByElement

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
    if (!(element instanceof XmlElement)) {
        return PsiReference.EMPTY_ARRAY;
    }

    List<PsiReference> psiReferences = new ArrayList<>();

    String methodName = StringUtil.unquoteString(element.getText());

    PhpClass phpClass = DiIndex.getPhpClassOfServiceMethod((XmlElement) element);
    if (phpClass != null) {
        Collection<Method> methods = phpClass.getMethods();
        methods.removeIf(m -> !m.getName().equalsIgnoreCase(methodName));
        psiReferences.add(new PolyVariantReferenceBase(element, methods));
    }

    return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:21,代码来源:PhpServiceMethodReferenceProvider.java

示例4: extractRoutesForMethod

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
/**
 * Get list of Web API routes related to the specified method.
 * <p/>
 * Web API declarations for parent classes are taken into account.
 * Results are not cached.
 */
public List<XmlTag> extractRoutesForMethod(@NotNull Method method) {
    List<XmlTag> routesForMethod = WebApiTypesFileBasedIndex.getWebApiRoutes(method);
    PhpClass phpClass = method.getContainingClass();
    if (phpClass == null) {
        return routesForMethod;
    }
    for (PhpClass parent : method.getContainingClass().getSupers()) {
        for (Method parentMethod : parent.getMethods()) {
            if (parentMethod.getName().equals(method.getName())) {
                routesForMethod.addAll(extractRoutesForMethod(parentMethod));
            }
        }
    }
    return routesForMethod;
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:22,代码来源:WebApiLineMarkerProvider.java

示例5: controllerToRoutes

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
private static HashMap<String, Method> controllerToRoutes(PhpClass controller) {
    String part1 = controller.getName().replace("Controller", "");
    Collection<Method> methods = controller.getMethods();
    HashMap<String, Method> routes = new HashMap<>();
    for (Method method: methods ) {
        if (method.getName().length() > 6 && method.getName().substring(0, 6).equals("action") && Character.isUpperCase(method.getName().charAt(6))) {
            String part2 = method.getName().replace("action", "");
            part1 = StringUtils.CamelToId(part1, "-");
            part2 = StringUtils.CamelToId(part2, "-") ; // part2.replaceAll("(?<=[\\p{Lower}\\p{Digit}])[\\p{Upper}]", "-$0").toLowerCase();
            routes.put(part1 + "/" +part2, method);
        }
    }
    return routes;
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:15,代码来源:UrlUtils.java

示例6: addCompletions

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
@Override
public void addCompletions(
    @NotNull final CompletionParameters parameters,
    final ProcessingContext context,
    @NotNull final CompletionResultSet result
) {
    final PsiElement     element        = parameters.getPosition();
    final List<PhpClass> elementClasses = PhpClassUtil.resolve(element.getParent());

    if (elementClasses.isEmpty()) {
        return;
    }

    for (final PhpClass elementClass : elementClasses) {
        if (PhpClassUtil.findSuperOfType(elementClass, LaravelClasses.ELOQUENT_MODEL.toString()) == null) {
            return;
        }

        for (final Method method : elementClass.getMethods()) {
            if (method.getName().startsWith("scope")) {
                final String methodSliced = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, method.getName().substring(5));

                result.addElement(new CompletionContributorLookupElement(element, method, methodSliced));
            }
        }
    }
}
 
开发者ID:rentalhost,项目名称:laravel-insight,代码行数:28,代码来源:ScopeCompletionContributor.java

示例7: getPluginMethods

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
List<Method> getPluginMethods(@NotNull PhpClass plugin) {
    List<Method> methodList = new ArrayList<Method>();
    for (Method method : plugin.getMethods()) {
        if (method.getAccess().isPublic()) {
            String pluginMethodName = method.getName();
            if (pluginMethodName.length() > 6) {
                methodList.add(method);
            }
        }
    }
    return methodList;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:13,代码来源:PluginLineMarkerProvider.java

示例8: getRoutes

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
/**
 * Get sorted list of Web API routes related to the specified class.
 */
List<XmlTag> getRoutes(@NotNull PhpClass phpClass) {
    List<XmlTag> routesForClass = new ArrayList<>();
    for (Method method : phpClass.getMethods()) {
        routesForClass.addAll(getRoutes(method));
    }
    sortRoutes(routesForClass);
    return routesForClass;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:12,代码来源:WebApiLineMarkerProvider.java

示例9: fillResults

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
protected void fillResults(PhpClass serviceInterface, List<ResolveResult> results, String typeName) {
    for (Method method : serviceInterface.getMethods()) {
        if (method.getName().equals(typeName)) {
            results.add(
                new PhpResolveResult(method)
            );

            break;
        }
    }
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:12,代码来源:ServiceMethodResultsFiller.java

示例10: getPluginMethods

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
public List<Method> getPluginMethods(@NotNull PhpClass plugin) {
    List<Method> methodList = new ArrayList<Method>();
    for (Method method : plugin.getMethods()) {
        if (method.getAccess().isPublic()) {
            String pluginMethodName = method.getName();
            if (pluginMethodName.length() > 6) {
                methodList.add(method);
            }
        }
    }
    return methodList;
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:13,代码来源:PluginLineMarkerProvider.java

示例11: getRoutes

import com.jetbrains.php.lang.psi.elements.PhpClass; //导入方法依赖的package包/类
/**
 * Get sorted list of Web API routes related to the specified class.
 */
public List<XmlTag> getRoutes(@NotNull PhpClass phpClass) {
    List<XmlTag> routesForClass = new ArrayList<>();
    for (Method method : phpClass.getMethods()) {
        routesForClass.addAll(getRoutes(method));
    }
    sortRoutes(routesForClass);
    return routesForClass;
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:12,代码来源:WebApiLineMarkerProvider.java


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