original_string: public function get_or_create_instance($instanceid, $raterid, $itemid) {
          global $DB;
          if ($instanceid &&
                  $instance = $DB->get_record('grading_instances', array('id'  => $instanceid, 'raterid' => $raterid, 'itemid' => $itemid), '*', IGNORE_MISSING)) {
              return $this->get_instance($instance);
          }
          return $this->create_instance($raterid, $itemid);
      }
code: public function get_or_create_instance($instanceid, $raterid, $itemid) {
          global $DB;
          if ($instanceid &&
                  $instance = $DB->get_record('grading_instances', array('id'  => $instanceid, 'raterid' => $raterid, 'itemid' => $itemid), '*', IGNORE_MISSING)) {
              return $this->get_instance($instance);
          }
          return $this->create_instance($raterid, $itemid);
      }
code_tokens: public function get_or_create_instance ( $ instanceid , $ raterid , $ itemid ) { global $ DB ; if ( $ instanceid && $ instance = $ DB -> get_record ( 'grading_instances' , array ( 'id' => $ instanceid , 'raterid' => $ raterid , 'itemid' => $ itemid ) , '*' , IGNORE_MISSING ) ) { return $ this -> get_instance ( $ instance ) ; } return $ this -> create_instance ( $ raterid , $ itemid ) ; }
docstring: If instanceid is specified and grading instance exists and it is created by this rater for
  this item, this instance is returned.
  Otherwise new instance is created for the specified rater and itemid
  
  @param int $instanceid
  @param int $raterid
  @param int $itemid
  @return gradingform_instance
docstring_tokens: If instanceid is specified and grading instance exists and it is created by this rater for this item this instance is returned . Otherwise new instance is created for the specified rater and itemid