/**
  * Normalize the server data
  * @see GameQ_Filters_Core::filter()
  */
 public function filter($data, GameQ_Protocols_Core $protocol_instance)
 {
     $result = array();
     // No data passed so something bad happened
     if (empty($data)) {
         return $result;
     }
     // Here we check to see if we override these defaults.
     if (($normalize = $protocol_instance->getNormalize()) !== FALSE) {
         // Merge this stuff in
         $this->normalize = array_merge_recursive($this->normalize, $normalize);
     }
     // normalize the general items
     $result = $this->normalize($data, 'general');
     // normalize players
     if (isset($result['gq_players']) && is_array($result['gq_players'])) {
         // Don't rename the players array
         $result['players'] = $result['gq_players'];
         foreach ($result['players'] as $key => $player) {
             $result['players'][$key] = array_merge($player, $this->normalize($player, 'player'));
         }
         $result['gq_numplayers'] = count($result['players']);
     } else {
         $result['players'] = array();
     }
     // normalize teams
     if (isset($result['gq_teams']) && is_array($result['gq_teams'])) {
         // Don't rename the teams array
         $result['teams'] = $result['gq_teams'];
         foreach ($result['teams'] as $key => $team) {
             $result['teams'][$key] = array_merge($team, $this->normalize($team, 'team'));
         }
         $result['gq_numteams'] = count($result['teams']);
     } else {
         $result['teams'] = array();
     }
     unset($result['gq_players'], $result['gq_teams']);
     // Merge and sort array
     $result = array_merge($data, $result);
     ksort($result);
     return $result;
 }
 /**
  * Strip all the color junk from returns
  * @see GameQ_Filters_Core::filter()
  */
 public function filter($data, GameQ_Protocols_Core $protocol_instance)
 {
     // Check the type of protocol
     switch ($protocol_instance->protocol()) {
         case 'quake2':
         case 'quake3':
         case 'doom3':
             array_walk_recursive($data, array($this, 'stripQuake'));
             break;
         case 'unreal2':
         case 'ut3':
         case 'gamespy3':
             //not sure if gamespy3 supports ut colors but won't hurt
         //not sure if gamespy3 supports ut colors but won't hurt
         case 'gamespy2':
             array_walk_recursive($data, array($this, 'stripUT'));
             break;
         default:
             break;
     }
     return $data;
 }