String signature = null;
if(psiElement.length > 1) {
signature = getCallableSignature(psiElement[1], method);
}
filters.put(funcName, new TwigExtension(TwigExtensionType.SIMPLE_FUNCTION, signature));
}
}
return;
}
//array('form_javascript' => new \Twig_Function_Method($this, 'renderJavascript', array('is_safe' => array('html'))),);
if("Twig_Function_Method".equals(expressionName)) {
PsiElement arrayValue = element.getParent();
if(arrayValue != null && arrayValue.getNode().getElementType() == PhpElementTypes.ARRAY_VALUE) {
PsiElement arrayHash = arrayValue.getParent();
if(arrayHash instanceof ArrayHashElement) {
PsiElement arrayKey = ((ArrayHashElement) arrayHash).getKey();
String funcName = PhpElementsUtil.getStringValue(arrayKey);
if(funcName != null && !funcName.contains("*")) {
PsiElement[] parameters = element.getParameters();
String signature = null;
if(parameters.length > 1) {
if(parameters[0] instanceof Variable && "this".equals(((Variable) parameters[0]).getName())) {
String methodName = PhpElementsUtil.getStringValue(parameters[1]);
if(methodName != null) {
String presentableFQN = containingClass.getPresentableFQN();
if(presentableFQN != null) {
signature = String.format("#M#C\\%s.%s", presentableFQN, methodName);
}
}
}
}
filters.put(funcName, new TwigExtension(TwigExtensionType.FUNCTION_METHOD, signature));
}
}
}
return;
}
// array('form_help' => new \Twig_Function_Node('Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', array('is_safe' => array('html'))),)
if("Twig_Function_Node".equals(expressionName)) {
PsiElement arrayValue = element.getParent();
if(arrayValue != null && arrayValue.getNode().getElementType() == PhpElementTypes.ARRAY_VALUE) {
PsiElement arrayHash = arrayValue.getParent();
if(arrayHash instanceof ArrayHashElement) {
PsiElement arrayKey = ((ArrayHashElement) arrayHash).getKey();
String funcName = PhpElementsUtil.getStringValue(arrayKey);
if(funcName != null && !funcName.contains("*")) {
PsiElement[] parameters = element.getParameters();
String signature = null;
if(parameters.length > 0) {
String className = PhpElementsUtil.getStringValue(parameters[0]);
if(className != null) {
if(className.startsWith("\\")) {
className = className.substring(1);
}
signature = String.format("#M#C\\%s.%s", className, "compile");
}
}
filters.put(funcName, new TwigExtension(TwigExtensionType.FUNCTION_NODE, signature));
}
}
}
}