original_string: private function setup_plugin($comment) {
          global $DB;
          $this->context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
          if (!$this->context) {
              return false;
          }
          switch ($this->context->contextlevel) {
              case CONTEXT_BLOCK:
                  if ($block = $DB->get_record('block_instances', array('id' => $this->context->instanceid))) {
                      $this->plugintype = 'block';
                      $this->pluginname = $block->blockname;
                  } else {
                      return false;
                  }
                  break;
              case CONTEXT_MODULE:
                  $this->plugintype = 'mod';
                  $this->cm = get_coursemodule_from_id('', $this->context->instanceid);
                  $this->setup_course($this->cm->course);
                  $this->modinfo = get_fast_modinfo($this->course);
                  $this->pluginname = $this->modinfo->cms[$this->cm->id]->modname;
                  break;
          }
          return true;
      }
code: private function setup_plugin($comment) {
          global $DB;
          $this->context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
          if (!$this->context) {
              return false;
          }
          switch ($this->context->contextlevel) {
              case CONTEXT_BLOCK:
                  if ($block = $DB->get_record('block_instances', array('id' => $this->context->instanceid))) {
                      $this->plugintype = 'block';
                      $this->pluginname = $block->blockname;
                  } else {
                      return false;
                  }
                  break;
              case CONTEXT_MODULE:
                  $this->plugintype = 'mod';
                  $this->cm = get_coursemodule_from_id('', $this->context->instanceid);
                  $this->setup_course($this->cm->course);
                  $this->modinfo = get_fast_modinfo($this->course);
                  $this->pluginname = $this->modinfo->cms[$this->cm->id]->modname;
                  break;
          }
          return true;
      }
code_tokens: private function setup_plugin ( $ comment ) { global $ DB ; $ this -> context = context :: instance_by_id ( $ comment -> contextid , IGNORE_MISSING ) ; if ( ! $ this -> context ) { return false ; } switch ( $ this -> context -> contextlevel ) { case CONTEXT_BLOCK : if ( $ block = $ DB -> get_record ( 'block_instances' , array ( 'id' => $ this -> context -> instanceid ) ) ) { $ this -> plugintype = 'block' ; $ this -> pluginname = $ block -> blockname ; } else { return false ; } break ; case CONTEXT_MODULE : $ this -> plugintype = 'mod' ; $ this -> cm = get_coursemodule_from_id ( '' , $ this -> context -> instanceid ) ; $ this -> setup_course ( $ this -> cm -> course ) ; $ this -> modinfo = get_fast_modinfo ( $ this -> course ) ; $ this -> pluginname = $ this -> modinfo -> cms [ $ this -> cm -> id ] -> modname ; break ; } return true ; }
docstring: Sets up the module or block information for a comment
  
  @global moodle_database $DB
  @param stdClass $comment
  @return bool
docstring_tokens: Sets up the module or block information for a comment