public static function generate_overview_object(&$overview_table, $overview_type)
 {
     switch ($overview_type) {
         case 'GEOMETRIC_MEAN':
             $title = 'Geometric Mean';
             $math_call = array('pts_math', 'geometric_mean');
             break;
         case 'HARMONIC_MEAN':
             $title = 'Harmonic Mean';
             $math_call = array('pts_math', 'harmonic_mean');
             break;
         case 'AGGREGATE_SUM':
             $title = 'Aggregate Sum';
             $math_call = 'array_sum';
             break;
         default:
             return false;
     }
     $result_buffer = new pts_test_result_buffer();
     if ($overview_table instanceof pts_result_file) {
         list($days_keys1, $days_keys, $shred) = pts_ResultFileTable::result_file_to_result_table($overview_table);
         foreach ($shred as $system_key => &$system) {
             $to_show = array();
             foreach ($system as &$days) {
                 $days = $days->get_value();
             }
             array_push($to_show, pts_math::set_precision(call_user_func($math_call, $system), 2));
             $result_buffer->add_test_result($system_key, implode(',', $to_show), null);
         }
     } else {
         $days_keys = null;
         foreach ($overview_table as $system_key => &$system) {
             if ($days_keys == null) {
                 // TODO: Rather messy and inappropriate way of getting the days keys
                 $days_keys = array_keys($system);
                 break;
             }
         }
         foreach ($overview_table as $system_key => &$system) {
             $to_show = array();
             foreach ($system as &$days) {
                 array_push($to_show, call_user_func($math_call, $days));
             }
             $result_buffer->add_test_result($system_key, implode(',', $to_show), null);
         }
     }
     $test_profile = new pts_test_profile(null, null, false);
     $test_profile->set_test_title($title);
     $test_profile->set_result_scale($title);
     $test_profile->set_display_format('BAR_GRAPH');
     $test_result = new pts_test_result($test_profile);
     $test_result->set_used_arguments_description('Analytical Overview');
     $test_result->set_test_result_buffer($result_buffer);
     return $test_result;
 }
 public static function locate_interesting_results(&$result_file, &$flagged_results = null)
 {
     $result_objects = array();
     if (!is_array($flagged_results)) {
         $flagged_results = array();
         $system_id_keys = null;
         $result_object_index = -1;
         pts_ResultFileTable::result_file_to_result_table($result_file, $system_id_keys, $result_object_index, $flagged_results);
     }
     if (count($flagged_results) > 0) {
         asort($flagged_results);
         $flagged_results = array_slice(array_keys($flagged_results), -6);
         $flag_delta_objects = $result_file->get_result_objects($flagged_results);
         for ($i = 0; $i < count($flagged_results); $i++) {
             $result_objects[$flagged_results[$i]] = $flag_delta_objects[$i];
             unset($flag_delta_objects[$i]);
         }
     }
     return $result_objects;
 }