I have the following class:
class User {
public function setName($value) { ... }
public function setEmailAddress($value) { ... }
public function setUsername($value) { ... }
public function getName() { ... }
public function getEmailAddress() { ... }
public function getUsername() { ... }
public function isGroupAdministrator($groupId) { ... }
public function isMemberOfGroup($groupId) { ... }
public function isSiteAdministrator() { ... }
public function isRoot() { ... }
public function hasModulePermission($moduleId, $recordId, $permissionCode) { ... }
public function hasGroupPermission($groupId, $permissionCode) { ... }
public function hasContentPermission($recordId, $permissionCode) { ... }
public function hasModulePermission($moduleId, $recordId, $permissionCode) { ... }
public function canLogIn() { ... }
public function isLoggedIn() { ... }
public function setCanLogIn($canLogIn) { ... }
}
Is this becoming a "God Class?"
I am unsure whether I should split this class up. The problem in doing so is that this class's methods are used by its domain to determine whether to show given UI elements on web pages, so there is not any behavior in the class.
I suppose I could put the permission-related methods in some Permission class, making those methods static (eg. ::userIsGroupAdministrator(...), ::userIsMemberOfGroup(...) ::userHasGroupPermission(...), ::userHasContentPermission(...))
Any suggestions on how this class could be better?