original_string: public function get_instance_name() {
          if ($this->plugin === 'core') {
              $string = get_string('allevents', 'tool_monitor');
          } else {
              if ($this->cmid == 0) {
                  $string = get_string('allmodules', 'tool_monitor');
              } else {
                  $cms = get_fast_modinfo($this->courseid);
                  $cms = $cms->get_cms();
                  if (isset($cms[$this->cmid])) {
                      $string = $cms[$this->cmid]->get_formatted_name(); // Instance name.
                  } else {
                      // Something is wrong, instance is not present anymore.
                      $string = get_string('invalidmodule', 'tool_monitor');
                  }
              }
          }
  
          return $string;
      }
code: public function get_instance_name() {
          if ($this->plugin === 'core') {
              $string = get_string('allevents', 'tool_monitor');
          } else {
              if ($this->cmid == 0) {
                  $string = get_string('allmodules', 'tool_monitor');
              } else {
                  $cms = get_fast_modinfo($this->courseid);
                  $cms = $cms->get_cms();
                  if (isset($cms[$this->cmid])) {
                      $string = $cms[$this->cmid]->get_formatted_name(); // Instance name.
                  } else {
                      // Something is wrong, instance is not present anymore.
                      $string = get_string('invalidmodule', 'tool_monitor');
                  }
              }
          }
  
          return $string;
      }
code_tokens: public function get_instance_name ( ) { if ( $ this -> plugin === 'core' ) { $ string = get_string ( 'allevents' , 'tool_monitor' ) ; } else { if ( $ this -> cmid == 0 ) { $ string = get_string ( 'allmodules' , 'tool_monitor' ) ; } else { $ cms = get_fast_modinfo ( $ this -> courseid ) ; $ cms = $ cms -> get_cms ( ) ; if ( isset ( $ cms [ $ this -> cmid ] ) ) { $ string = $ cms [ $ this -> cmid ] -> get_formatted_name ( ) ; // Instance name. } else { // Something is wrong, instance is not present anymore. $ string = get_string ( 'invalidmodule' , 'tool_monitor' ) ; } } } return $ string ; }
docstring: Get a human readable name for instances associated with this subscription.
  
  @return string
  @throws \coding_exception
docstring_tokens: Get a human readable name for instances associated with this subscription .