Code Duplication    Length = 5-6 lines in 2 locations

main/gradebook/lib/be/category.class.php 2 locations

@@ 329-333 (lines=5) @@
326
     */
327
    public static function load_session_categories($id = null, $session_id = null)
328
    {
329
        if (isset($id) && (int)$id === 0) {
330
            $cats = array();
331
            $cats[] = Category::create_root_category();
332
            return $cats;
333
        }
334
335
        $courseCode = api_get_course_info_by_id(api_get_course_int_id());
336
        $courseCode = $courseCode['code'];
@@ 382-387 (lines=6) @@
379
    ) {
380
        //if the category given is explicitly 0 (not null), then create
381
        // a root category object (in memory)
382
        if (isset($id) && (int)$id === 0) {
383
            $cats = array();
384
            $cats[] = Category::create_root_category();
385
386
            return $cats;
387
        }
388
389
        $tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
390
        $sql = 'SELECT * FROM '.$tbl_grade_categories;