original_string: public static function clean_ruledata_form($mformdata) {
          global $USER;
  
          $rule = new \stdClass();
          if (!empty($mformdata->ruleid)) {
              $rule->id = $mformdata->ruleid;
          }
          $rule->userid = empty($mformdata->userid) ? $USER->id : $mformdata->userid;
          $rule->courseid = $mformdata->courseid;
          $rule->name = $mformdata->name;
          $rule->plugin = $mformdata->plugin;
          $rule->eventname = $mformdata->eventname;
          $rule->description = $mformdata->description['text'];
          $rule->descriptionformat = $mformdata->description['format'];
          $rule->frequency = $mformdata->frequency;
          $rule->timewindow = $mformdata->minutes * MINSECS;
          $rule->template = $mformdata->template['text'];
          $rule->templateformat = $mformdata->template['format'];
  
          return $rule;
      }
code: public static function clean_ruledata_form($mformdata) {
          global $USER;
  
          $rule = new \stdClass();
          if (!empty($mformdata->ruleid)) {
              $rule->id = $mformdata->ruleid;
          }
          $rule->userid = empty($mformdata->userid) ? $USER->id : $mformdata->userid;
          $rule->courseid = $mformdata->courseid;
          $rule->name = $mformdata->name;
          $rule->plugin = $mformdata->plugin;
          $rule->eventname = $mformdata->eventname;
          $rule->description = $mformdata->description['text'];
          $rule->descriptionformat = $mformdata->description['format'];
          $rule->frequency = $mformdata->frequency;
          $rule->timewindow = $mformdata->minutes * MINSECS;
          $rule->template = $mformdata->template['text'];
          $rule->templateformat = $mformdata->template['format'];
  
          return $rule;
      }
code_tokens: public static function clean_ruledata_form ( $ mformdata ) { global $ USER ; $ rule = new \ stdClass ( ) ; if ( ! empty ( $ mformdata -> ruleid ) ) { $ rule -> id = $ mformdata -> ruleid ; } $ rule -> userid = empty ( $ mformdata -> userid ) ? $ USER -> id : $ mformdata -> userid ; $ rule -> courseid = $ mformdata -> courseid ; $ rule -> name = $ mformdata -> name ; $ rule -> plugin = $ mformdata -> plugin ; $ rule -> eventname = $ mformdata -> eventname ; $ rule -> description = $ mformdata -> description [ 'text' ] ; $ rule -> descriptionformat = $ mformdata -> description [ 'format' ] ; $ rule -> frequency = $ mformdata -> frequency ; $ rule -> timewindow = $ mformdata -> minutes * MINSECS ; $ rule -> template = $ mformdata -> template [ 'text' ] ; $ rule -> templateformat = $ mformdata -> template [ 'format' ] ; return $ rule ; }
docstring: Clean data submitted by mform.
  
  @param \stdClass $mformdata data to insert as new rule entry.
  
  @return \stdClass Cleaned rule data.
docstring_tokens: Clean data submitted by mform .