original_string: public function get_course_module(event_interface $event) {
          if (!$event->get_course_module()) {
              return null;
          }
  
          $id = $event->get_course_module()->get('id');
          $name = $event->get_course_module()->get('modname');
          $key = $name . '_' . $id;
  
          if (!isset($this->coursemodules[$key])) {
              $this->coursemodules[$key] = get_coursemodule_from_instance($name, $id, 0, false, MUST_EXIST);
          }
  
          return $this->coursemodules[$key];
      }
code: public function get_course_module(event_interface $event) {
          if (!$event->get_course_module()) {
              return null;
          }
  
          $id = $event->get_course_module()->get('id');
          $name = $event->get_course_module()->get('modname');
          $key = $name . '_' . $id;
  
          if (!isset($this->coursemodules[$key])) {
              $this->coursemodules[$key] = get_coursemodule_from_instance($name, $id, 0, false, MUST_EXIST);
          }
  
          return $this->coursemodules[$key];
      }
code_tokens: public function get_course_module ( event_interface $ event ) { if ( ! $ event -> get_course_module ( ) ) { return null ; } $ id = $ event -> get_course_module ( ) -> get ( 'id' ) ; $ name = $ event -> get_course_module ( ) -> get ( 'modname' ) ; $ key = $ name . '_' . $ id ; if ( ! isset ( $ this -> coursemodules [ $ key ] ) ) { $ this -> coursemodules [ $ key ] = get_coursemodule_from_instance ( $ name , $ id , 0 , false , MUST_EXIST ) ; } return $ this -> coursemodules [ $ key ] ; }
docstring: Get the related course module for a given event.
  
  @param event_interface $event The event object.
  @return stdClass|null
docstring_tokens: Get the related course module for a given event .