original_string: protected function ensure_categories_loaded() {
          global $DB;
          $this->ensure_category_loaded();
          if (!is_null(end($this->_categories))) {
              return; // Already done.
          }
          $idstoload = array_keys($this->_categories);
          array_shift($idstoload);
          $categories = $DB->get_records_list('course_categories', 'id', $idstoload);
          foreach ($idstoload as $catid) {
              $this->_categories[$catid] = $categories[$catid];
          }
      }
code: protected function ensure_categories_loaded() {
          global $DB;
          $this->ensure_category_loaded();
          if (!is_null(end($this->_categories))) {
              return; // Already done.
          }
          $idstoload = array_keys($this->_categories);
          array_shift($idstoload);
          $categories = $DB->get_records_list('course_categories', 'id', $idstoload);
          foreach ($idstoload as $catid) {
              $this->_categories[$catid] = $categories[$catid];
          }
      }
code_tokens: protected function ensure_categories_loaded ( ) { global $ DB ; $ this -> ensure_category_loaded ( ) ; if ( ! is_null ( end ( $ this -> _categories ) ) ) { return ; // Already done. } $ idstoload = array_keys ( $ this -> _categories ) ; array_shift ( $ idstoload ) ; $ categories = $ DB -> get_records_list ( 'course_categories' , 'id' , $ idstoload ) ; foreach ( $ idstoload as $ catid ) { $ this -> _categories [ $ catid ] = $ categories [ $ catid ] ; } }
docstring: Ensures that the category the current course is within, as well as all of
  its parent categories, have been loaded.
  
  @return void
docstring_tokens: Ensures that the category the current course is within as well as all of its parent categories have been loaded .