original_string: protected function load_courses() {
          global $DB;
  
          $courseids = [];
          foreach ($this->events as $event) {
              if ($course = $event->get_course()) {
                  $id = $course->get('id');
                  $courseids[$id] = true;
              }
          }
  
          if (empty($courseids)) {
              $this->courses = [];
              return;
          }
  
          list($idsql, $params) = $DB->get_in_or_equal(array_keys($courseids));
          $sql = "SELECT * FROM {course} WHERE id {$idsql}";
  
          $this->courses = $DB->get_records_sql($sql, $params);
      }
code: protected function load_courses() {
          global $DB;
  
          $courseids = [];
          foreach ($this->events as $event) {
              if ($course = $event->get_course()) {
                  $id = $course->get('id');
                  $courseids[$id] = true;
              }
          }
  
          if (empty($courseids)) {
              $this->courses = [];
              return;
          }
  
          list($idsql, $params) = $DB->get_in_or_equal(array_keys($courseids));
          $sql = "SELECT * FROM {course} WHERE id {$idsql}";
  
          $this->courses = $DB->get_records_sql($sql, $params);
      }
code_tokens: protected function load_courses ( ) { global $ DB ; $ courseids = [ ] ; foreach ( $ this -> events as $ event ) { if ( $ course = $ event -> get_course ( ) ) { $ id = $ course -> get ( 'id' ) ; $ courseids [ $ id ] = true ; } } if ( empty ( $ courseids ) ) { $ this -> courses = [ ] ; return ; } list ( $ idsql , $ params ) = $ DB -> get_in_or_equal ( array_keys ( $ courseids ) ) ; $ sql = "SELECT * FROM {course} WHERE id {$idsql}" ; $ this -> courses = $ DB -> get_records_sql ( $ sql , $ params ) ; }
docstring: Load the list of all of the distinct courses required for the
  list of provided events and save the result in memory.
docstring_tokens: Load the list of all of the distinct courses required for the list of provided events and save the result in memory .