You are here

private function heartbeatParser::remove_variables_duplicates in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 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::merge_sets in includes/heartbeatparser.inc
Merges sets of messages to fully formatted messages regenerated at runtime to group settings

File

includes/heartbeatparser.inc, line 219

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;
}