| Conditions | 2 |
| Paths | 2 |
| Total Lines | 51 |
| Code Lines | 45 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 49 | protected function setupNavMenuAccess($currentUser) |
||
| 50 | { |
||
| 51 | $this->assign('nav__canRequests', $this->getSecurityManager() |
||
| 52 | ->allows(PageMain::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 53 | |||
| 54 | $this->assign('nav__canLogs', $this->getSecurityManager() |
||
| 55 | ->allows(PageLog::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 56 | $this->assign('nav__canUsers', $this->getSecurityManager() |
||
| 57 | ->allows(StatsUsers::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 58 | $this->assign('nav__canSearch', $this->getSecurityManager() |
||
| 59 | ->allows(PageSearch::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 60 | $this->assign('nav__canStats', $this->getSecurityManager() |
||
| 61 | ->allows(StatsMain::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 62 | |||
| 63 | $this->assign('nav__canBan', $this->getSecurityManager() |
||
| 64 | ->allows(PageBan::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 65 | $this->assign('nav__canEmailMgmt', $this->getSecurityManager() |
||
| 66 | ->allows(PageEmailManagement::class, RoleConfigurationBase::MAIN, |
||
| 67 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 68 | $this->assign('nav__canWelcomeMgmt', $this->getSecurityManager() |
||
| 69 | ->allows(PageWelcomeTemplateManagement::class, RoleConfigurationBase::MAIN, |
||
| 70 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 71 | $this->assign('nav__canSiteNoticeMgmt', $this->getSecurityManager() |
||
| 72 | ->allows(PageSiteNotice::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 73 | $this->assign('nav__canUserMgmt', $this->getSecurityManager() |
||
| 74 | ->allows(PageUserManagement::class, RoleConfigurationBase::MAIN, |
||
| 75 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 76 | $this->assign('nav__canJobQueue', $this->getSecurityManager() |
||
| 77 | ->allows(PageJobQueue::class, RoleConfigurationBase::MAIN, |
||
| 78 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 79 | $this->assign('nav__canDomainMgmt', $this->getSecurityManager() |
||
| 80 | ->allows(PageDomainManagement::class, RoleConfigurationBase::MAIN, |
||
| 81 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 82 | $this->assign('nav__canFlaggedComments', $this->getSecurityManager() |
||
| 83 | ->allows(PageListFlaggedComments::class, RoleConfigurationBase::MAIN, |
||
| 84 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 85 | $this->assign('nav__canQueueMgmt', $this->getSecurityManager() |
||
| 86 | ->allows(PageQueueManagement::class, RoleConfigurationBase::MAIN, |
||
| 87 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 88 | $this->assign('nav__canFormMgmt', $this->getSecurityManager() |
||
| 89 | ->allows(PageRequestFormManagement::class, RoleConfigurationBase::MAIN, |
||
| 90 | $currentUser) === ISecurityManager::ALLOWED); |
||
| 91 | $this->assign('nav__canErrorLog', $this->getSecurityManager() |
||
| 92 | ->allows(PageErrorLogViewer::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 93 | |||
| 94 | $this->assign('nav__canViewRequest', $this->getSecurityManager() |
||
| 95 | ->allows(PageViewRequest::class, RoleConfigurationBase::MAIN, $currentUser) === ISecurityManager::ALLOWED); |
||
| 96 | |||
| 97 | $this->assign('nav__domainList', []); |
||
| 98 | if ($this->getDomainAccessManager() !== null) { |
||
| 99 | $this->assign('nav__domainList', $this->getDomainAccessManager()->getAllowedDomains($currentUser)); |
||
| 100 | } |
||
| 145 |