original_string: public static function delete_ratings(\context $context, string $component = null,
              string $ratingarea = null, int $itemid = null) {
          global $DB;
  
          $options = ['contextid' => $context->id];
          if ($component) {
              $options['component'] = $component;
          }
          if ($ratingarea) {
              $options['ratingarea'] = $ratingarea;
          }
          if ($itemid) {
              $options['itemid'] = $itemid;
          }
  
          $DB->delete_records('rating', $options);
      }
code: public static function delete_ratings(\context $context, string $component = null,
              string $ratingarea = null, int $itemid = null) {
          global $DB;
  
          $options = ['contextid' => $context->id];
          if ($component) {
              $options['component'] = $component;
          }
          if ($ratingarea) {
              $options['ratingarea'] = $ratingarea;
          }
          if ($itemid) {
              $options['itemid'] = $itemid;
          }
  
          $DB->delete_records('rating', $options);
      }
code_tokens: public static function delete_ratings ( \ context $ context , string $ component = null , string $ ratingarea = null , int $ itemid = null ) { global $ DB ; $ options = [ 'contextid' => $ context -> id ] ; if ( $ component ) { $ options [ 'component' ] = $ component ; } if ( $ ratingarea ) { $ options [ 'ratingarea' ] = $ ratingarea ; } if ( $ itemid ) { $ options [ 'itemid' ] = $ itemid ; } $ DB -> delete_records ( 'rating' , $ options ) ; }
docstring: Deletes all ratings for a specified context, component, ratingarea and itemid.
  
  Only delete ratings when the item itself was deleted.
  
  We never delete ratings for one user but not others - this may affect grades, therefore ratings
  made by particular user are not considered personal information.
  
  @param  \context $context Details about which context to delete ratings for.
  @param  string $component Component to delete.
  @param  string $ratingarea Rating area to delete.
  @param  int $itemid The item ID for use with deletion.
docstring_tokens: Deletes all ratings for a specified context component ratingarea and itemid .