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];
    }
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];
    }
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 ] ; }
Get the related course module for a given event.

@param event_interface $event The event object.
@return stdClass|null
Get the related course module for a given event .