original_string: public static function fetch_course_category($courseid) {
          if (empty($courseid)) {
              debugging('Missing course id!');
              return false;
          }
  
          // course category has no parent
          if ($course_category = grade_category::fetch(array('courseid'=>$courseid, 'parent'=>null))) {
              return $course_category;
          }
  
          // create a new one
          $course_category = new grade_category();
          $course_category->insert_course_category($courseid);
  
          return $course_category;
      }
code: public static function fetch_course_category($courseid) {
          if (empty($courseid)) {
              debugging('Missing course id!');
              return false;
          }
  
          // course category has no parent
          if ($course_category = grade_category::fetch(array('courseid'=>$courseid, 'parent'=>null))) {
              return $course_category;
          }
  
          // create a new one
          $course_category = new grade_category();
          $course_category->insert_course_category($courseid);
  
          return $course_category;
      }
code_tokens: public static function fetch_course_category ( $ courseid ) { if ( empty ( $ courseid ) ) { debugging ( 'Missing course id!' ) ; return false ; } // course category has no parent if ( $ course_category = grade_category :: fetch ( array ( 'courseid' => $ courseid , 'parent' => null ) ) ) { return $ course_category ; } // create a new one $ course_category = new grade_category ( ) ; $ course_category -> insert_course_category ( $ courseid ) ; return $ course_category ; }
docstring: Return the course level grade_category object
  
  @param int $courseid The Course ID
  @return grade_category Returns the course level grade_category instance
docstring_tokens: Return the course level grade_category object