original_string: public function get_course(event_interface $event) {
          if (is_null($this->courses)) {
              $this->load_courses();
          }
  
          if ($course = $event->get_course()) {
              $courseid = $course->get('id');
              return isset($this->courses[$courseid]) ? $this->courses[$courseid] : null;
          } else {
              return null;
          }
      }
code: public function get_course(event_interface $event) {
          if (is_null($this->courses)) {
              $this->load_courses();
          }
  
          if ($course = $event->get_course()) {
              $courseid = $course->get('id');
              return isset($this->courses[$courseid]) ? $this->courses[$courseid] : null;
          } else {
              return null;
          }
      }
code_tokens: public function get_course ( event_interface $ event ) { if ( is_null ( $ this -> courses ) ) { $ this -> load_courses ( ) ; } if ( $ course = $ event -> get_course ( ) ) { $ courseid = $ course -> get ( 'id' ) ; return isset ( $ this -> courses [ $ courseid ] ) ? $ this -> courses [ $ courseid ] : null ; } else { return null ; } }
docstring: Get the related course object for a given event.
  
  @param event_interface $event The event object.
  @return stdClass|null
docstring_tokens: Get the related course object for a given event .