• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PhpPatterns类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jetbrains.php.lang.patterns.PhpPatterns的典型用法代码示例。如果您正苦于以下问题:Java PhpPatterns类的具体用法?Java PhpPatterns怎么用?Java PhpPatterns使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PhpPatterns类属于com.jetbrains.php.lang.patterns包,在下文中一共展示了PhpPatterns类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: methodParamsList

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
public static PsiElementPattern.Capture<PsiElement> methodParamsList(String methodName,
                                                                     StringPattern className) {
    return PlatformPatterns.psiElement().withElementType(PhpElementTypes.PARAMETER_LIST)
            .withParent(
                    PlatformPatterns.psiElement()
                            .withElementType(PhpElementTypes.METHOD_REFERENCE)
                            .referencing(
                                    PhpPatterns.psiElement().withElementType(
                                            PhpElementTypes.CLASS_METHOD
                                    ).withName(methodName)
                                            .withParent(
                                                    PhpPatterns.psiElement().withName(
                                                            className
                                                    ))
                            )

            );
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:19,代码来源:YiiContibutorHelper.java


示例2: appFieldPattern

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
public static PsiElementPattern.Capture appFieldPattern() {
    return PlatformPatterns.psiElement()
            .withParent(PlatformPatterns.psiElement().withElementType(PhpElementTypes.FIELD_REFERENCE)
                    .withChild(
                            PlatformPatterns.psiElement().withElementType(PhpElementTypes.METHOD_REFERENCE)
                                    .referencing(
                                            PhpPatterns.psiElement().withElementType(PhpElementTypes.CLASS_METHOD)
                                                    .withName("app").withParent(
                                                    PhpPatterns.psiElement()
                                                            .withElementType(PhpElementTypes.CLASS)
                                                            .withName(StandardPatterns.string().oneOf("Yii", "YiiBase"))
                                            )
                                    )
                    )
            ).withLanguage(PhpLanguage.INSTANCE);

}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:18,代码来源:YiiAppCompletionContributor.java


示例3: isStringArrayValue

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
@NotNull
public static PsiElementPattern.Capture<PsiElement> isStringArrayValue() {

    return PhpPatterns.psiElement()
            .andOr(
                    PhpPatterns.psiElement().withParent(
                        PlatformPatterns.psiElement(StringLiteralExpression.class)
                            .withParent(PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE))
                    ),
                    PlatformPatterns.psiElement(StringLiteralExpression.class)
                                    .withParent(PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE))
            );
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:14,代码来源:PhpElementsUtil.java


示例4: findArrayCreationExpression

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
@Nullable
private ArrayCreationExpression findArrayCreationExpression(@NotNull StringLiteralExpression psiElement, @NotNull String key) {

    // value inside array
    // $menu->addChild(array(
    //   'route' => 'foo',
    // ));
    if(PhpPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).accepts(psiElement.getContext())) {
        PsiElement arrayValue = psiElement.getContext();
        if(arrayValue != null) {
            PsiElement arrayHashElement = arrayValue.getContext();
            if(arrayHashElement instanceof ArrayHashElement) {
                PhpPsiElement arrayKey = ((ArrayHashElement) arrayHashElement).getKey();
                if(arrayKey instanceof StringLiteralExpression && ((StringLiteralExpression) arrayKey).getContents().equals(key)) {
                    PsiElement arrayCreationExpression = arrayHashElement.getContext();
                    if(arrayCreationExpression instanceof ArrayCreationExpression) {
                        if(!(arrayCreationExpression.getParent() instanceof ParameterList)) {
                            return null;
                        }

                        return (ArrayCreationExpression) arrayCreationExpression;
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:30,代码来源:ArrayKeyValueSignatureRegistrarMatcher.java


示例5: isContributedElement

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
public boolean isContributedElement(PsiElement psiElement, MethodParameterSetting config) {

            // value inside array
            // $menu->addChild(array(
            //   'route' => 'foo',
            // ));
            if(PhpPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).accepts(psiElement.getContext())) {
                PsiElement arrayValue = psiElement.getContext();
                if(arrayValue != null) {
                    PsiElement arrayHashElement = arrayValue.getContext();
                    if(arrayHashElement instanceof ArrayHashElement) {
                        PhpPsiElement arrayKey = ((ArrayHashElement) arrayHashElement).getKey();
                        if(arrayKey instanceof StringLiteralExpression && ((StringLiteralExpression) arrayKey).getContents().equals(config.getContributorData())) {
                            PsiElement arrayCreationExpression = arrayHashElement.getContext();
                            if(arrayCreationExpression instanceof ArrayCreationExpression) {
                                if(arrayCreationExpression.getParent() instanceof ParameterList) {
                                    return true;
                                }
                            }
                        }

                    }
                }

            }

            return false;
        }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:29,代码来源:DefaultReferenceContributor.java


示例6: pattern

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
/**
 * $menu->addChild([
 *   'route' => '<caret>',
 * ]);
 */
@NotNull
public static PsiElementPattern.Capture<PsiElement> pattern() {
    return PhpPatterns.psiElement().withParent(
        PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(
            PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).inside(ParameterList.class)
        )
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:14,代码来源:ArrayValueWithKeyAndNewExpressionMatcher.java


示例7: getArrayKeyValueMap

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
/**
 * array('foo' => 'bar', 'foo1' => 'bar', 1 => 'foo')
 */
@NotNull
static public HashMap<String, String> getArrayKeyValueMap(@NotNull ArrayCreationExpression arrayCreationExpression) {
    HashMap<String, String> keys = new HashMap<>();

    for(ArrayHashElement arrayHashElement: arrayCreationExpression.getHashElements()) {
        PhpPsiElement child = arrayHashElement.getKey();
        if(child != null && ((child instanceof StringLiteralExpression) || PhpPatterns.psiElement(PhpElementTypes.NUMBER).accepts(child))) {

            String key;
            if(child instanceof StringLiteralExpression) {
                key = ((StringLiteralExpression) child).getContents();
            } else {
                key = child.getText();
            }

            if(key == null || StringUtils.isBlank(key)) {
                continue;
            }

            String value = null;

            if(arrayHashElement.getValue() instanceof StringLiteralExpression) {
                value = ((StringLiteralExpression) arrayHashElement.getValue()).getContents();
            }

            if(value == null || StringUtils.isBlank(value)) {
                continue;
            }

            keys.put(key, value);
        }
    }

    return keys;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:39,代码来源:PhpElementsUtil.java


示例8: methodLiteralExpression

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
public static PhpElementPattern.Capture<StringLiteralExpression> methodLiteralExpression(String methodName,
                                                                                         StringPattern className) {
    return PhpPatterns.phpLiteralExpression()
            .withParent(
                    methodParamsList(methodName, className)
            );
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:8,代码来源:YiiContibutorHelper.java


示例9: paramListInMethodWithName

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
public static PsiElementPattern.Capture<PsiElement> paramListInMethodWithName(String methodName) {
    return PlatformPatterns.psiElement().withElementType(PhpElementTypes.PARAMETER_LIST)
            .withParent(
                    PlatformPatterns.psiElement().withElementType(PhpElementTypes.METHOD_REFERENCE)
                            .referencing(PhpPatterns.psiElement().withElementType(PhpElementTypes.CLASS_METHOD)
                                    .withName(methodName)
                            )
            );
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:10,代码来源:YiiContibutorHelper.java


示例10: arrayInMethodWithName

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
public static PsiElementPattern.Capture<PsiElement> arrayInMethodWithName(String methodName) {
    return PlatformPatterns.psiElement().withElementType(PhpElementTypes.ARRAY_CREATION_EXPRESSION)
            .withParent(
                    PlatformPatterns.psiElement().withElementType(PhpElementTypes.METHOD_REFERENCE)
                            .referencing(PhpPatterns.psiElement().withElementType(PhpElementTypes.CLASS_METHOD)
                                    .withName(methodName)
                            )
            );
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:10,代码来源:YiiContibutorHelper.java


示例11: mapOptionsArrayParam

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
private void mapOptionsArrayParam(TYPO3ServiceDefinition serviceDefinition, Iterable<ArrayHashElement> optionsArray) {
    for (ArrayHashElement element : optionsArray) {
        if (null == element.getKey() || !(element.getKey() instanceof StringLiteralExpression)) {
            continue;
        }

        String key = ((StringLiteralExpression) element.getKey()).getContents();
        // Assign string properties of the service definition options
        if (null != element.getValue() && element.getValue() instanceof StringLiteralExpression) {
            String value = ((StringLiteralExpression) element.getValue()).getContents();
            switch (key) {
                case "os":
                    serviceDefinition.setOs(value);
                    break;
                case "title":
                    serviceDefinition.setTitle(value);
                    break;
                case "description":
                    serviceDefinition.setDescription(value);
                    break;
                case "subtype":
                    serviceDefinition.setSubType(value);
                    break;
                case "exec":
                    serviceDefinition.setExec(value);
                    break;
            }
        }

        // Assign numbers
        if (null != element.getValue() && PhpPatterns.psiElement(PhpElementTypes.NUMBER).accepts(element.getValue())) {
            switch (key) {
                case "priority":
                    serviceDefinition.setPriority(new Integer(element.getValue().getText()));
                    break;
                case "quality":
                    serviceDefinition.setQuality(new Integer(element.getValue().getText()));
                    break;
            }
        }
    }
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:43,代码来源:CoreServiceDefinitionParserVisitor.java


示例12: shouldSkipAutopopup

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {

    if(!(psiFile instanceof PhpFile)) {
        return ThreeState.UNSURE;
    }

    PsiElement context = contextElement.getContext();
    if(context instanceof StringLiteralExpression) {

        // foo="<|>"
        if(PhpPatterns.psiElement(PhpDocElementTypes.phpDocString).accepts(context)) {
            return ThreeState.NO;
        }

    } else if(context instanceof PhpDocComment) {

        // * <|>
        if(PhpPatterns.psiElement().afterLeafSkipping(
            PhpPatterns.psiElement(PsiWhiteSpace.class),
            PhpPatterns.psiElement(PhpDocTokenTypes.DOC_LEADING_ASTERISK)
        ).accepts(contextElement)) {
            return ThreeState.NO;
        }

    } else if(context instanceof PhpPsiElementImpl) {

        // @Foo(<|>)
        if(PhpPatterns.psiElement(PhpDocElementTypes.phpDocAttributeList).accepts(context)) {
            return ThreeState.NO;
        }

        // @<|>
        if(PhpPatterns.psiElement(PhpDocElementTypes.phpDocTag).accepts(context)) {
            return ThreeState.NO;
        }

    }

    return ThreeState.UNSURE;
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:43,代码来源:PhpAnnotationCompletionConfidence.java


示例13: registerReferenceProviders

import com.jetbrains.php.lang.patterns.PhpPatterns; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {

    psiReferenceRegistrar.registerReferenceProvider(PhpPatterns.psiElement(PhpElementTypes.PARAMETER),
            new PhpStringLiteralExpressionReference(ParameterReference.class)
                    .addCall("Yii", "getParameter")
    );


}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:11,代码来源:YiiApplicationReferenceContributor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JobEntrySpecial类代码示例发布时间:2022-05-23
下一篇:
Java ConversionException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap