original_string: public function delete_ratings($options) {
          global $DB;
  
          if (empty($options->contextid)) {
              throw new coding_exception('The context option is a required option when deleting ratings.');
          }
  
          $conditions = array('contextid' => $options->contextid);
          $possibleconditions = array(
              'ratingid'   => 'id',
              'userid'     => 'userid',
              'itemid'     => 'itemid',
              'component'  => 'component',
              'ratingarea' => 'ratingarea'
          );
          foreach ($possibleconditions as $option => $field) {
              if (isset($options->{$option})) {
                  $conditions[$field] = $options->{$option};
              }
          }
          $DB->delete_records('rating', $conditions);
      }
code: public function delete_ratings($options) {
          global $DB;
  
          if (empty($options->contextid)) {
              throw new coding_exception('The context option is a required option when deleting ratings.');
          }
  
          $conditions = array('contextid' => $options->contextid);
          $possibleconditions = array(
              'ratingid'   => 'id',
              'userid'     => 'userid',
              'itemid'     => 'itemid',
              'component'  => 'component',
              'ratingarea' => 'ratingarea'
          );
          foreach ($possibleconditions as $option => $field) {
              if (isset($options->{$option})) {
                  $conditions[$field] = $options->{$option};
              }
          }
          $DB->delete_records('rating', $conditions);
      }
code_tokens: public function delete_ratings ( $ options ) { global $ DB ; if ( empty ( $ options -> contextid ) ) { throw new coding_exception ( 'The context option is a required option when deleting ratings.' ) ; } $ conditions = array ( 'contextid' => $ options -> contextid ) ; $ possibleconditions = array ( 'ratingid' => 'id' , 'userid' => 'userid' , 'itemid' => 'itemid' , 'component' => 'component' , 'ratingarea' => 'ratingarea' ) ; foreach ( $ possibleconditions as $ option => $ field ) { if ( isset ( $ options -> { $ option } ) ) { $ conditions [ $ field ] = $ options -> { $ option } ; } } $ DB -> delete_records ( 'rating' , $ conditions ) ; }
docstring: Delete one or more ratings. Specify either a rating id, an item id or just the context id.
  
  @global moodle_database $DB
  @param stdClass $options {
  contextid => int the context in which the ratings exist [required]
  ratingid => int the id of an individual rating to delete [optional]
  userid => int delete the ratings submitted by this user. May be used in conjuction with itemid [optional]
  itemid => int delete all ratings attached to this item [optional]
  component => string The component to delete ratings from [optional]
  ratingarea => string The ratingarea to delete ratings from [optional]
  }
docstring_tokens: Delete one or more ratings . Specify either a rating id an item id or just the context id .