original_string: public static function course_deleted(\core\event\course_deleted $event) {
          // Delete rules defined inside this course and associated subscriptions.
          $rules = rule_manager::get_rules_by_courseid($event->courseid, 0, 0, false);
          foreach ($rules as $rule) {
              rule_manager::delete_rule($rule->id, $event->get_context());
          }
          // Delete remaining subscriptions inside this course (from site-wide rules).
          subscription_manager::remove_all_subscriptions_in_course($event->get_context());
      }
code: public static function course_deleted(\core\event\course_deleted $event) {
          // Delete rules defined inside this course and associated subscriptions.
          $rules = rule_manager::get_rules_by_courseid($event->courseid, 0, 0, false);
          foreach ($rules as $rule) {
              rule_manager::delete_rule($rule->id, $event->get_context());
          }
          // Delete remaining subscriptions inside this course (from site-wide rules).
          subscription_manager::remove_all_subscriptions_in_course($event->get_context());
      }
code_tokens: public static function course_deleted ( \ core \ event \ course_deleted $ event ) { // Delete rules defined inside this course and associated subscriptions. $ rules = rule_manager :: get_rules_by_courseid ( $ event -> courseid , 0 , 0 , false ) ; foreach ( $ rules as $ rule ) { rule_manager :: delete_rule ( $ rule -> id , $ event -> get_context ( ) ) ; } // Delete remaining subscriptions inside this course (from site-wide rules). subscription_manager :: remove_all_subscriptions_in_course ( $ event -> get_context ( ) ) ; }
docstring: Course delete event observer.
  This observer monitors course delete event, and when a course is deleted it deletes any rules and subscriptions associated
  with it, so no orphan data is left behind.
  
  @param \core\event\course_deleted $event The course deleted event.
docstring_tokens: Course delete event observer . This observer monitors course delete event and when a course is deleted it deletes any rules and subscriptions associated with it so no orphan data is left behind .