public function get_module_instance(event_interface $event) {
        if (!$event->get_course_module()) {
            return null;
        }

        if (is_null($this->moduleinstances)) {
            $this->load_module_instances();
        }

        $id = $event->get_course_module()->get('instance');
        $name = $event->get_course_module()->get('modname');

        if (isset($this->moduleinstances[$name])) {
            if (isset($this->moduleinstances[$name][$id])) {
                return $this->moduleinstances[$name][$id];
            }
        }

        return null;
    }
public function get_module_instance(event_interface $event) {
        if (!$event->get_course_module()) {
            return null;
        }

        if (is_null($this->moduleinstances)) {
            $this->load_module_instances();
        }

        $id = $event->get_course_module()->get('instance');
        $name = $event->get_course_module()->get('modname');

        if (isset($this->moduleinstances[$name])) {
            if (isset($this->moduleinstances[$name][$id])) {
                return $this->moduleinstances[$name][$id];
            }
        }

        return null;
    }
public function get_module_instance ( event_interface $ event ) { if ( ! $ event -> get_course_module ( ) ) { return null ; } if ( is_null ( $ this -> moduleinstances ) ) { $ this -> load_module_instances ( ) ; } $ id = $ event -> get_course_module ( ) -> get ( 'instance' ) ; $ name = $ event -> get_course_module ( ) -> get ( 'modname' ) ; if ( isset ( $ this -> moduleinstances [ $ name ] ) ) { if ( isset ( $ this -> moduleinstances [ $ name ] [ $ id ] ) ) { return $ this -> moduleinstances [ $ name ] [ $ id ] ; } } return null ; }
Get the related module instance for a given event.

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