* Returns groups by given type. Returns all groups if no types given.
*
* @param array<integer> $types
- * @return array<UserGroup>
+ * @return array<wcf\data\user\group\UserGroup>
*/
public static function getGroupsByType(array $types = array()) {
self::getCache();
* Returns unique group by given type. Only works for the default user groups.
*
* @param integer $type
- * @return UserGroup
+ * @return wcf\data\user\group\UserGroup
*/
public static function getGroupByType($type) {
if ($type != self::EVERYONE && $type != self::GUESTS && $type != self::USERS) {
return array_shift($groups);
}
+ /**
+ * Returns a group from _cache_ by given groupID.
+ * null is returned when the given groupID is invalid.
+ *
+ * @param integer $groupID
+ * @return wcf\data\user\group\UserGroup
+ */
+ public static function getGroupByID($groupID) {
+ self::getCache();
+
+ if (isset(self::$cache['groups'][$groupID])) {
+ return self::$cache['groups'][$groupID];
+ }
+
+ return null;
+ }
+
/**
* Returns true, if the given user is member of the group. If no user is
* given, the active user is used.