Search in sources :

Example 1 with CoreServiceParser

use of com.cedricziel.idea.typo3.container.CoreServiceParser in project idea-php-typo3-plugin by cedricziel.

the class GeneralUtilityServiceTypeProvider method getBySignature.

@Override
public Collection<? extends PhpNamedElement> getBySignature(String expression, Set<String> visited, int depth, Project project) {
    Collection<PhpNamedElement> phpNamedElementCollections = new ArrayList<>();
    PhpIndex phpIndex = PhpIndex.getInstance(project);
    CoreServiceParser serviceParser = new CoreServiceParser();
    serviceParser.collect(project);
    List<TYPO3ServiceDefinition> resolvedServices = serviceParser.resolve(project, expression);
    if (resolvedServices == null || resolvedServices.isEmpty()) {
        return phpNamedElementCollections;
    }
    resolvedServices.forEach(serviceDefinition -> {
        Collection<PhpClass> classesByFQN = phpIndex.getClassesByFQN(serviceDefinition.getClassName());
        phpNamedElementCollections.addAll(classesByFQN);
    });
    return phpNamedElementCollections;
}
Also used : TYPO3ServiceDefinition(com.cedricziel.idea.typo3.domain.TYPO3ServiceDefinition) PhpNamedElement(com.jetbrains.php.lang.psi.elements.PhpNamedElement) PhpIndex(com.jetbrains.php.PhpIndex) PhpClass(com.jetbrains.php.lang.psi.elements.PhpClass) ArrayList(java.util.ArrayList) CoreServiceParser(com.cedricziel.idea.typo3.container.CoreServiceParser)

Aggregations

CoreServiceParser (com.cedricziel.idea.typo3.container.CoreServiceParser)1 TYPO3ServiceDefinition (com.cedricziel.idea.typo3.domain.TYPO3ServiceDefinition)1 PhpIndex (com.jetbrains.php.PhpIndex)1 PhpClass (com.jetbrains.php.lang.psi.elements.PhpClass)1 PhpNamedElement (com.jetbrains.php.lang.psi.elements.PhpNamedElement)1 ArrayList (java.util.ArrayList)1