original_string: public function get_course() {
          global $DB;
          if (!$this->courseid) {
              return null;
          }
          if ($this->course === false) {
              $this->course = get_course($this->courseid);
              $options = $this->get_format_options();
              $dbcoursecolumns = null;
              foreach ($options as $optionname => $optionvalue) {
                  if (isset($this->course->$optionname)) {
                      // Course format options must not have the same names as existing columns in db table "course".
                      if (!isset($dbcoursecolumns)) {
                          $dbcoursecolumns = $DB->get_columns('course');
                      }
                      if (isset($dbcoursecolumns[$optionname])) {
                          debugging('The option name '.$optionname.' in course format '.$this->format.
                              ' is invalid because the field with the same name exists in {course} table',
                              DEBUG_DEVELOPER);
                          continue;
                      }
                  }
                  $this->course->$optionname = $optionvalue;
              }
          }
          return $this->course;
      }
code: public function get_course() {
          global $DB;
          if (!$this->courseid) {
              return null;
          }
          if ($this->course === false) {
              $this->course = get_course($this->courseid);
              $options = $this->get_format_options();
              $dbcoursecolumns = null;
              foreach ($options as $optionname => $optionvalue) {
                  if (isset($this->course->$optionname)) {
                      // Course format options must not have the same names as existing columns in db table "course".
                      if (!isset($dbcoursecolumns)) {
                          $dbcoursecolumns = $DB->get_columns('course');
                      }
                      if (isset($dbcoursecolumns[$optionname])) {
                          debugging('The option name '.$optionname.' in course format '.$this->format.
                              ' is invalid because the field with the same name exists in {course} table',
                              DEBUG_DEVELOPER);
                          continue;
                      }
                  }
                  $this->course->$optionname = $optionvalue;
              }
          }
          return $this->course;
      }
code_tokens: public function get_course ( ) { global $ DB ; if ( ! $ this -> courseid ) { return null ; } if ( $ this -> course === false ) { $ this -> course = get_course ( $ this -> courseid ) ; $ options = $ this -> get_format_options ( ) ; $ dbcoursecolumns = null ; foreach ( $ options as $ optionname => $ optionvalue ) { if ( isset ( $ this -> course -> $ optionname ) ) { // Course format options must not have the same names as existing columns in db table "course". if ( ! isset ( $ dbcoursecolumns ) ) { $ dbcoursecolumns = $ DB -> get_columns ( 'course' ) ; } if ( isset ( $ dbcoursecolumns [ $ optionname ] ) ) { debugging ( 'The option name ' . $ optionname . ' in course format ' . $ this -> format . ' is invalid because the field with the same name exists in {course} table' , DEBUG_DEVELOPER ) ; continue ; } } $ this -> course -> $ optionname = $ optionvalue ; } } return $ this -> course ; }
docstring: Returns a record from course database table plus additional fields
  that course format defines
  
  @return stdClass
docstring_tokens: Returns a record from course database table plus additional fields that course format defines