original_string: protected static function get_fields_sql($target, $alias, $prefix) {
          switch ($target) {
              case 'grade_category':
              case 'grade_grade':
              case 'grade_item':
              case 'grade_outcome':
              case 'grade_scale':
                  $obj = new $target([], false);
                  $fields = array_merge(array_keys($obj->optional_fields), $obj->required_fields);
                  break;
  
              case 'grade_grades_history':
                  $fields = ['id', 'action', 'oldid', 'source', 'timemodified', 'loggeduser', 'itemid', 'userid', 'rawgrade',
                      'rawgrademax', 'rawgrademin', 'rawscaleid', 'usermodified', 'finalgrade', 'hidden', 'locked', 'locktime',
                      'exported', 'overridden', 'excluded', 'feedback', 'feedbackformat', 'information', 'informationformat'];
                  break;
  
              default:
                  throw new \coding_exception('Unrecognised target: ' . $target);
                  break;
          }
  
          return implode(', ', array_map(function($field) use ($alias, $prefix) {
              return "{$alias}.{$field} AS {$prefix}{$field}";
          }, $fields));
      }
code: protected static function get_fields_sql($target, $alias, $prefix) {
          switch ($target) {
              case 'grade_category':
              case 'grade_grade':
              case 'grade_item':
              case 'grade_outcome':
              case 'grade_scale':
                  $obj = new $target([], false);
                  $fields = array_merge(array_keys($obj->optional_fields), $obj->required_fields);
                  break;
  
              case 'grade_grades_history':
                  $fields = ['id', 'action', 'oldid', 'source', 'timemodified', 'loggeduser', 'itemid', 'userid', 'rawgrade',
                      'rawgrademax', 'rawgrademin', 'rawscaleid', 'usermodified', 'finalgrade', 'hidden', 'locked', 'locktime',
                      'exported', 'overridden', 'excluded', 'feedback', 'feedbackformat', 'information', 'informationformat'];
                  break;
  
              default:
                  throw new \coding_exception('Unrecognised target: ' . $target);
                  break;
          }
  
          return implode(', ', array_map(function($field) use ($alias, $prefix) {
              return "{$alias}.{$field} AS {$prefix}{$field}";
          }, $fields));
      }
code_tokens: protected static function get_fields_sql ( $ target , $ alias , $ prefix ) { switch ( $ target ) { case 'grade_category' : case 'grade_grade' : case 'grade_item' : case 'grade_outcome' : case 'grade_scale' : $ obj = new $ target ( [ ] , false ) ; $ fields = array_merge ( array_keys ( $ obj -> optional_fields ) , $ obj -> required_fields ) ; break ; case 'grade_grades_history' : $ fields = [ 'id' , 'action' , 'oldid' , 'source' , 'timemodified' , 'loggeduser' , 'itemid' , 'userid' , 'rawgrade' , 'rawgrademax' , 'rawgrademin' , 'rawscaleid' , 'usermodified' , 'finalgrade' , 'hidden' , 'locked' , 'locktime' , 'exported' , 'overridden' , 'excluded' , 'feedback' , 'feedbackformat' , 'information' , 'informationformat' ] ; break ; default : throw new \ coding_exception ( 'Unrecognised target: ' . $ target ) ; break ; } return implode ( ', ' , array_map ( function ( $ field ) use ( $ alias , $ prefix ) { return "{$alias}.{$field} AS {$prefix}{$field}" ; } , $ fields ) ) ; }
docstring: Get fields SQL for a grade related object.
  
  @param string $target The related object.
  @param string $alias The table alias.
  @param string $prefix A prefix.
  @return string
docstring_tokens: Get fields SQL for a grade related object .