Java Code Examples for com.jetbrains.php.lang.psi.elements.FunctionReference#getParameters()

The following examples show how to use com.jetbrains.php.lang.psi.elements.FunctionReference#getParameters() . 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: TemplateUtil.java    From Thinkphp5-Plugin with MIT License 6 votes vote down vote up
private void visitFunctionReference(FunctionReference functionReference) {

            if (!"view".equals(functionReference.getName())) {
                return;
            }

            PsiElement[] parameters = functionReference.getParameters();

            if (parameters.length < 1 || !(parameters[0] instanceof StringLiteralExpression)) {
                return;
            }

            String contents = ((StringLiteralExpression) parameters[0]).getContents();
            if (StringUtils.isBlank(contents)) {
                return;
            }

            views.add(Pair.create(contents, parameters[0]));
        }
 
Example 2
Source File: BladeTemplateUtil.java    From idea-php-laravel-plugin with MIT License 6 votes vote down vote up
private void visitFunctionReference(FunctionReference functionReference) {

            if(!"view".equals(functionReference.getName())) {
                return;
            }

            PsiElement[] parameters = functionReference.getParameters();

            if(parameters.length < 1 || !(parameters[0] instanceof StringLiteralExpression)) {
                return;
            }

            String contents = ((StringLiteralExpression) parameters[0]).getContents();
            if(StringUtils.isBlank(contents)) {
                return;
            }

            views.add(Pair.create(contents, parameters[0]));
        }
 
Example 3
Source File: PhpMetaUtil.java    From idea-php-advanced-autocomplete with MIT License 5 votes vote down vote up
public static FunctionReference getMetaFunctionReferenceWithName(PhpCallInstruction instruction, String name) {
    FunctionReference reference = instruction.getFunctionReference();
    if (!metaFunctionWithName(reference, name)) {
        return null;
    } else {
        PsiElement[] parameters = reference.getParameters();
        return parameters.length < 1 ? null : ObjectUtils.tryCast(parameters[0], FunctionReference.class);
    }
}
 
Example 4
Source File: PhpEnvironmentCallsVisitor.java    From idea-php-dotenv-plugin with MIT License 3 votes vote down vote up
private void visitFunction(FunctionReference expression) {

        if(!PhpPsiHelper.isEnvFunction(expression)) return;

        PsiElement[] parameters = expression.getParameters();

        if(parameters.length == 0) return;

        if(!(parameters[0] instanceof StringLiteralExpression)) return;

        String key = ((StringLiteralExpression)parameters[0]).getContents();

        collectedItems.add(new KeyUsagePsiElement(key, parameters[0]));
    }