本文整理汇总了Java中com.jetbrains.php.PhpClassHierarchyUtils类的典型用法代码示例。如果您正苦于以下问题:Java PhpClassHierarchyUtils类的具体用法?Java PhpClassHierarchyUtils怎么用?Java PhpClassHierarchyUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhpClassHierarchyUtils类属于com.jetbrains.php包,在下文中一共展示了PhpClassHierarchyUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTestClass
import com.jetbrains.php.PhpClassHierarchyUtils; //导入依赖的package包/类
public static boolean isTestClass(@NotNull PhpClass phpClass) {
if (phpClass.isAbstract() || phpClass.isInterface() || phpClass.isTrait()) {
return false;
}
final Ref<Boolean> isTestCase = new Ref<>(false);
PhpClassHierarchyUtils.processSuperClasses(phpClass, true, true, phpClass1 -> {
String superFQN = phpClass1.getSuperFQN();
if (superFQN != null && PhpLangUtil.equalsClassNames("\\Tester\\TestCase", superFQN)) {
isTestCase.set(true);
}
return !isTestCase.get();
});
return isTestCase.get();
}
示例2: namedElementHasParentWithDoc
import com.jetbrains.php.PhpClassHierarchyUtils; //导入依赖的package包/类
static boolean namedElementHasParentWithDoc(final PhpNamedElement phpNamedElement)
{
final ArrayList<PhpElementWithModifier> results = new ArrayList<>(10);
if (phpNamedElement instanceof Method) {
PhpClassHierarchyUtils.processSuperMembers((PhpClassMember) phpNamedElement, (method, subClass, baseClass) -> {
results.add(method);
return true;
});
} else if (phpNamedElement instanceof PhpClass) {
results.addAll(PhpClassHierarchyUtils.getImmediateParents((PhpClass)phpNamedElement));
}
String commentString = "";
for (Object result : results) {
PhpNamedElement superMember = (PhpNamedElement) result;
if (superMember.isValid() && superMember.getDocComment() != null) {
commentString = superMember.getDocComment().getText();
}
if (commentString.length() > 0) {
break;
}
}
return (commentString.length() > 0);
}
示例3: matches
import com.jetbrains.php.PhpClassHierarchyUtils; //导入依赖的package包/类
@Override
public boolean matches(PhpNamedElement element) {
if (!(element instanceof PhpClass)) {
return false;
}
Collection<PhpClass> parentClasses = PhpIndex.getInstance(element.getProject()).getAnyByFQN(parentClassName);
if (parentClasses.size() == 0) {
return false;
}
PhpClass parentClass = parentClasses.iterator().next();
return PhpClassHierarchyUtils.getAllSubclasses(parentClass).contains(element);
}
示例4: getPlaceholderTextForCommentImpl
import com.jetbrains.php.PhpClassHierarchyUtils; //导入依赖的package包/类
private String getPlaceholderTextForCommentImpl(PhpDocCommentImpl psiElement) {
PsiElement phpNamedElement = psiElement.getOwner();
if (! psiElement.hasInheritDocTag()) {
return null;
}
final ArrayList<PhpElementWithModifier> results = new ArrayList<>(1);
if(phpNamedElement instanceof Method) {
PhpClassHierarchyUtils.processSuperMembers((PhpClassMember) phpNamedElement, (method, subClass, baseClass) -> {
results.add(method);
return true;
});
} else if(phpNamedElement instanceof PhpClass) {
results.addAll(PhpClassHierarchyUtils.getImmediateParents((PhpClass)phpNamedElement));
}
if (results.isEmpty()) {
return null;
}
for (Object result : results) {
PhpNamedElement superMember = (PhpNamedElement) result;
String commentString;
if (superMember.isValid() && superMember.getDocComment() != null) {
if (superMember.getDocComment().hasInheritDocTag()) {
return this.getPlaceholderTextForCommentImpl((PhpDocCommentImpl) superMember.getDocComment());
}
commentString = superMember.getDocComment().getText().replaceAll("\\s+", " ");
commentString = commentString.replaceAll("/\\*+", "");
commentString = commentString.replaceAll("\\*/", "");
commentString = commentString.replaceAll("^\\s\\*?", "");
commentString = commentString.replaceAll("\\s+\\*[\\s\\*]?\\s", " * ");
commentString = commentString.trim();
return commentString;
}
}
// no valid supermember found
return null;
}