package com.intellij.structuralsearch.duplicates;

import com.intellij.lang.Language;
import com.intellij.psi.PsiElement;
import com.jetbrains.php.lang.PhpLanguage;
import com.jetbrains.php.lang.psi.elements.Function;
import com.jetbrains.php.lang.psi.elements.PhpExpression;
import com.jetbrains.php.lang.psi.elements.Statement;
import org.jetbrains.annotations.NotNull;

/**
 * @author Eugene.Kudelevsky
 */
public class PhpDuplicatesProfile extends SSRDuplicatesProfileBase {
  @Override
  public int getNodeCost(@NotNull PsiElement element) {
    if (element instanceof Statement || element instanceof Function) {
      return 2;
    }
    else if (element instanceof PhpExpression) {
      return 1;
    }
    return 0;
  }

  @Override
  public boolean isMyLanguage(@NotNull Language language) {
    return language.isKindOf(PhpLanguage.INSTANCE);
  }
}

@@ -130,38 +130,34 @@
 com.
-jetbrains.php.lang.PhpLanguage
+intellij.psi.tree.TokenSet
 ;%0Aim
@@ -188,29 +188,19 @@
 ang.
-psi.elements.Function
+PhpLanguage
 ;%0Aim
@@ -231,34 +231,27 @@
 ang.
-psi.elements.PhpExpression
+lexer.PhpTokenTypes
 ;%0Aim
@@ -291,25 +291,17 @@
 lements.
-Statement
+*
 ;%0Aimport
@@ -762,24 +762,24 @@
 language) %7B%0A
-
     return l
@@ -821,11 +821,675 @@
 CE);%0A  %7D
+%0A%0A  @Override%0A  public PsiElementRole getRole(@NotNull PsiElement element) %7B%0A    final PsiElement parent = element.getParent();%0A%0A    if (parent instanceof Variable && ((Variable)parent).getNameIdentifier() == element) %7B%0A      return PsiElementRole.VARIABLE_NAME;%0A    %7D%0A    else if (parent instanceof Field && ((Field)parent).getNameIdentifier() == element) %7B%0A      return PsiElementRole.FIELD_NAME;%0A    %7D%0A    else if (parent instanceof Function && ((Function)parent).getNameIdentifier() == element) %7B%0A      return PsiElementRole.FUNCTION_NAME;%0A    %7D%0A    return null;%0A  %7D%0A%0A  @Override%0A  public TokenSet getLiterals() %7B%0A    return PhpTokenTypes.tsCOMMON_SCALARS;%0A  %7D
 %0A%7D%0A

support anonymization for php duplocator