original_string: public static function fetch_course_tree($courseid, $include_category_items=false) {
          $course_category = grade_category::fetch_course_category($courseid);
          $category_array = array('object'=>$course_category, 'type'=>'category', 'depth'=>1,
                                  'children'=>$course_category->get_children($include_category_items));
  
          $course_category->sortorder = $course_category->get_sortorder();
          $sortorder = $course_category->get_sortorder();
          return grade_category::_fetch_course_tree_recursion($category_array, $sortorder);
      }
code: public static function fetch_course_tree($courseid, $include_category_items=false) {
          $course_category = grade_category::fetch_course_category($courseid);
          $category_array = array('object'=>$course_category, 'type'=>'category', 'depth'=>1,
                                  'children'=>$course_category->get_children($include_category_items));
  
          $course_category->sortorder = $course_category->get_sortorder();
          $sortorder = $course_category->get_sortorder();
          return grade_category::_fetch_course_tree_recursion($category_array, $sortorder);
      }
code_tokens: public static function fetch_course_tree ( $ courseid , $ include_category_items = false ) { $ course_category = grade_category :: fetch_course_category ( $ courseid ) ; $ category_array = array ( 'object' => $ course_category , 'type' => 'category' , 'depth' => 1 , 'children' => $ course_category -> get_children ( $ include_category_items ) ) ; $ course_category -> sortorder = $ course_category -> get_sortorder ( ) ; $ sortorder = $ course_category -> get_sortorder ( ) ; return grade_category :: _fetch_course_tree_recursion ( $ category_array , $ sortorder ) ; }
docstring: Returns tree with all grade_items and categories as elements
  
  @param int $courseid The course ID
  @param bool $include_category_items as category children
  @return array
docstring_tokens: Returns tree with all grade_items and categories as elements