original_string: public function get_question_categories($parent=null, $sort="sortorder ASC") {
          global $COURSE, $DB;
          if (is_null($parent)) {
              $categories = $DB->get_records('question_categories', array('course' => $COURSE->id), $sort);
          } else {
              $select = "parent = ? AND course = ?";
              $categories = $DB->get_records_select('question_categories', $select, array($parent, $COURSE->id), $sort);
          }
          return $categories;
      }
code: public function get_question_categories($parent=null, $sort="sortorder ASC") {
          global $COURSE, $DB;
          if (is_null($parent)) {
              $categories = $DB->get_records('question_categories', array('course' => $COURSE->id), $sort);
          } else {
              $select = "parent = ? AND course = ?";
              $categories = $DB->get_records_select('question_categories', $select, array($parent, $COURSE->id), $sort);
          }
          return $categories;
      }
code_tokens: public function get_question_categories ( $ parent = null , $ sort = "sortorder ASC" ) { global $ COURSE , $ DB ; if ( is_null ( $ parent ) ) { $ categories = $ DB -> get_records ( 'question_categories' , array ( 'course' => $ COURSE -> id ) , $ sort ) ; } else { $ select = "parent = ? AND course = ?" ; $ categories = $ DB -> get_records_select ( 'question_categories' , $ select , array ( $ parent , $ COURSE -> id ) , $ sort ) ; } return $ categories ; }
docstring: Gets question categories
  
  @param    int parent - if given, restrict records to those with this parent id.
  @param    string sort - [[sortfield [,sortfield]] {ASC|DESC}]
  @return   array categories
docstring_tokens: Gets question categories