You are here

private function heartbeatParser::remove_variables_duplicates in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 includes/heartbeatparser.inc \heartbeatParser::remove_variables_duplicates()
  2. 7 includes/heartbeatparser.inc \heartbeatParser::remove_variables_duplicates()

Function to remove duplicate messages valuating the variables and count properties

1 call to heartbeatParser::remove_variables_duplicates()
heartbeatParser::clean_up in includes/heartbeatparser.inc
Function to clean up dirty messages and xss attacks

File

includes/heartbeatparser.inc, line 189
HeartbeatParser object

Class

heartbeatParser
Class heartbeatParser

Code

private function remove_variables_duplicates() {
  $uniques = array();
  foreach ($this->_candidates as $single_id => $info) {
    $uniques[$single_id] = array();

    // Loop through variables to check if there are identical
    foreach ($info['variables'] as $rid => $value) {
      if (!in_array($value, $uniques[$single_id])) {
        $uniques[$single_id][] = $value;
      }
      else {
        unset($this->_candidates[$single_id]['variables'][$rid]);
      }
    }
  }

  // Re-evaluate the counts
  foreach ($this->_candidates as $single_id => $info) {
    $this->_candidates[$single_id]['count'] = count($this->_candidates[$single_id]['variables']);
  }
  return $uniques;
}