return false;
}
try {
if (useTrait) {
TextSequence statementText = getStatementText();
if (statementText.toString().indexOf('{') >= 0
|| statementText.toString().indexOf('}') >= 0) {
return false;
}
} else {
String previousWord = getPreviousWord();
if (!"use".equalsIgnoreCase(previousWord)) { //$NON-NLS-1$
return false;
}
}
} catch (BadLocationException e) {
PHPCorePlugin.log(e);
}
if (getPhpVersion().isLessThan(PHPVersion.PHP5_3)) {
return false;
}
TextSequence statementText = getStatementText();
int totalLength = statementText.length();
int endPosition = PHPTextSequenceUtilities.readBackwardSpaces(
statementText, totalLength); // read whitespace
elementStart = PHPTextSequenceUtilities.readIdentifierStartIndex(
statementText, endPosition, true);
elementStart = PHPTextSequenceUtilities.readBackwardSpaces(
statementText, elementStart);
if (elementStart < 1) { // there's no trigger of length less than 1
// characters
return false;
}
String triggerText = statementText.subSequence(elementStart - 1,
elementStart).toString();
if (!triggerText.equals("\\")) { //$NON-NLS-1$
return false;
}
isGlobal = false;
if (elementStart == 1) {
isGlobal = true;
return true;
}
int endNamespace = PHPTextSequenceUtilities.readBackwardSpaces(
statementText, elementStart - 1);
int nsNameStart = PHPTextSequenceUtilities.readNamespaceStartIndex(
statementText, endNamespace, false);
String nsName = statementText.subSequence(nsNameStart, elementStart)
.toString();
if (nsName.indexOf('\\') < 0) {
return false;
}
if (!nsName.startsWith("\\")) { //$NON-NLS-1$