Java Code Examples for com.jetbrains.php.PhpIndex#getChildNamespacesByParentName()
The following examples show how to use
com.jetbrains.php.PhpIndex#getChildNamespacesByParentName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhpIndexUtil.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull private static Collection<PhpClass> getPhpClassInsideNamespace(@NotNull Project project, @NotNull PhpIndex phpIndex, @NotNull String namespaceName, int maxDeep) { final Collection<PhpClass> phpClasses = new ArrayList<>(); if(maxDeep-- <= 0) { return phpClasses; } for (PhpNamespace phpNamespace : phpIndex.getNamespacesByName(namespaceName.toLowerCase())) { phpClasses.addAll(PsiTreeUtil.getChildrenOfTypeAsList(phpNamespace.getStatements(), PhpClass.class)); } for(String ns: phpIndex.getChildNamespacesByParentName(namespaceName + "\\")) { phpClasses.addAll(getPhpClassInsideNamespace(project, phpIndex, namespaceName + "\\" + ns, maxDeep)); } return phpClasses; }
Example 2
Source File: PhpIndexUtil.java From idea-php-annotation-plugin with MIT License | 6 votes |
private static Collection<PhpClass> getPhpClassInsideNamespace(Project project, PhpIndex phpIndex, String namespaceName, int maxDeep) { final Collection<PhpClass> phpClasses = new ArrayList<>(); if(maxDeep-- <= 0) { return phpClasses; } StubIndex.getInstance().processElements(PhpNamespaceIndex.KEY, namespaceName.toLowerCase(), project, phpIndex.getSearchScope(), PhpNamespace.class, phpNamespace -> { phpClasses.addAll(PsiTreeUtil.getChildrenOfTypeAsList(phpNamespace.getStatements(), PhpClass.class)); return true; }); for(String ns: phpIndex.getChildNamespacesByParentName(namespaceName + "\\")) { phpClasses.addAll(getPhpClassInsideNamespace(project, phpIndex, namespaceName + "\\" + ns, maxDeep)); } return phpClasses; }