original_string: protected function delete_instance($component, $itemtype, $itemid, $tiuserid = 0) {
          global $DB;
          $params = array('tagid' => $this->id,
                  'itemtype' => $itemtype, 'itemid' => $itemid);
          if ($tiuserid) {
              $params['tiuserid'] = $tiuserid;
          }
          if ($component) {
              $params['component'] = $component;
          }
  
          $taginstance = $DB->get_record('tag_instance', $params);
          if (!$taginstance) {
              return;
          }
          $this->delete_instance_as_record($taginstance, true);
      }
code: protected function delete_instance($component, $itemtype, $itemid, $tiuserid = 0) {
          global $DB;
          $params = array('tagid' => $this->id,
                  'itemtype' => $itemtype, 'itemid' => $itemid);
          if ($tiuserid) {
              $params['tiuserid'] = $tiuserid;
          }
          if ($component) {
              $params['component'] = $component;
          }
  
          $taginstance = $DB->get_record('tag_instance', $params);
          if (!$taginstance) {
              return;
          }
          $this->delete_instance_as_record($taginstance, true);
      }
code_tokens: protected function delete_instance ( $ component , $ itemtype , $ itemid , $ tiuserid = 0 ) { global $ DB ; $ params = array ( 'tagid' => $ this -> id , 'itemtype' => $ itemtype , 'itemid' => $ itemid ) ; if ( $ tiuserid ) { $ params [ 'tiuserid' ] = $ tiuserid ; } if ( $ component ) { $ params [ 'component' ] = $ component ; } $ taginstance = $ DB -> get_record ( 'tag_instance' , $ params ) ; if ( ! $ taginstance ) { return ; } $ this -> delete_instance_as_record ( $ taginstance , true ) ; }
docstring: Delete one instance of a tag.  If the last instance was deleted, it will also delete the tag, unless it is standard.
  
  @param    string $component component responsible for tagging. For BC it can be empty but in this case the
  query will be slow because DB index will not be used.
  @param    string $itemtype the type of the record for which to remove the instance
  @param    int    $itemid   the id of the record for which to remove the instance
  @param    int    $tiuserid tag instance user id, only needed for tag areas with user tagging (such as core/course)
docstring_tokens: Delete one instance of a tag . If the last instance was deleted it will also delete the tag unless it is standard .