@Nullable public static String getArrayHashValue( ArrayCreationExpression arrayCreationExpression, String keyName) { ArrayHashElement translationArrayHashElement = PsiElementUtils.getChildrenOfType( arrayCreationExpression, PlatformPatterns.psiElement(ArrayHashElement.class) .withFirstChild( PlatformPatterns.psiElement(PhpElementTypes.ARRAY_KEY) .withText( PlatformPatterns.string() .oneOf("'" + keyName + "'", "\"" + keyName + "\"")))); if (translationArrayHashElement == null) { return null; } if (!(translationArrayHashElement.getValue() instanceof StringLiteralExpression)) { return null; } StringLiteralExpression valueString = (StringLiteralExpression) translationArrayHashElement.getValue(); if (valueString == null) { return null; } return valueString.getContents(); }
public static String getMethodParameter(PsiElement parameter) { if (!(parameter instanceof StringLiteralExpression)) { return null; } StringLiteralExpression stringLiteralExpression = (StringLiteralExpression) parameter; String stringValue = stringLiteralExpression.getText(); String value = stringValue.substring( stringLiteralExpression.getValueRange().getStartOffset(), stringLiteralExpression.getValueRange().getEndOffset()); return removeIdeaRuleHack(value); }
public RouteParameterReference(@NotNull StringLiteralExpression element, String routeName) { super(element); this.routeName = routeName; this.parameterName = element.getContents(); }