public override StaticAnalysisAlert[] GetAlerts(string code, PhpToken[] tokens)
 {
     return tokens
         .Where(x =>
             x.TokenType == PhpTokenType.BacktickString &&
             Php.Superglobals
                 .Any(y => x.Lexeme.Contains(y)))
         .Select(x => CreateAlert(code, x))
         .ToArray();
 }
        public static Dictionary<string, List<string>> FindSuperglobalFields(PhpToken[] tokens)
        {
            var fields = PhpParser.GetSuperglobalFields(tokens);

            foreach (var superglobal in tokens
                .Where(x => x.TokenType == PhpTokenType.String ||
                    x.TokenType == PhpTokenType.HereDocString ||
                    x.TokenType == PhpTokenType.BacktickString)
                .Select(x => GetSuperGlobalFieldsFromText(x.Lexeme))
                .SelectMany(x => x))
                fields[superglobal.Key].AddRange(superglobal.Value);

            return fields;
        }
 public static PhpToken[] StripWhitespaceAndComments(PhpToken[] tokens)
 {
     return tokens
         .Where(x =>
             x.TokenType != PhpTokenType.WhiteSpace &&
             x.TokenType != PhpTokenType.Comment)
         .ToArray();
 }