public static function get_default() {
        if ($visiblechildren = self::top()->get_children()) {
            $defcategory = reset($visiblechildren);
        } else {
            $toplevelcategories = self::get_tree(0);
            $defcategoryid = $toplevelcategories[0];
            $defcategory = self::get($defcategoryid, MUST_EXIST, true);
        }
        return $defcategory;
    }
public static function get_default() {
        if ($visiblechildren = self::top()->get_children()) {
            $defcategory = reset($visiblechildren);
        } else {
            $toplevelcategories = self::get_tree(0);
            $defcategoryid = $toplevelcategories[0];
            $defcategory = self::get($defcategoryid, MUST_EXIST, true);
        }
        return $defcategory;
    }
public static function get_default ( ) { if ( $ visiblechildren = self :: top ( ) -> get_children ( ) ) { $ defcategory = reset ( $ visiblechildren ) ; } else { $ toplevelcategories = self :: get_tree ( 0 ) ; $ defcategoryid = $ toplevelcategories [ 0 ] ; $ defcategory = self :: get ( $ defcategoryid , MUST_EXIST , true ) ; } return $ defcategory ; }
Returns the first found category

Note that if there are no categories visible to the current user on the first level,
the invisible category may be returned

@return core_course_category
Returns the first found category