Conditions | 1 |
Paths | 1 |
Total Lines | 61 |
Code Lines | 57 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
114 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
115 | { |
||
116 | $this->layout = 'layouts/administration'; |
||
117 | |||
118 | $filesystem = new Filesystem(new Local(Webtrees::ROOT_DIR)); |
||
119 | $files_to_delete = $this->housekeeping_service->deleteOldWebtreesFiles($filesystem); |
||
120 | |||
121 | return $this->viewResponse('admin/control-panel', [ |
||
122 | 'title' => I18N::translate('Control panel'), |
||
123 | 'server_errors' => $this->server_check_service->serverErrors(), |
||
124 | 'server_warnings' => $this->server_check_service->serverWarnings(), |
||
125 | 'latest_version' => $this->upgrade_service->latestVersion(), |
||
126 | 'all_users' => $this->user_service->all(), |
||
127 | 'administrators' => $this->user_service->administrators(), |
||
128 | 'managers' => $this->user_service->managers(), |
||
129 | 'moderators' => $this->user_service->moderators(), |
||
130 | 'unapproved' => $this->user_service->unapproved(), |
||
131 | 'unverified' => $this->user_service->unverified(), |
||
132 | 'all_trees' => $this->tree_service->all(), |
||
133 | 'changes' => $this->totalChanges(), |
||
134 | 'individuals' => $this->totalIndividuals(), |
||
135 | 'families' => $this->totalFamilies(), |
||
136 | 'sources' => $this->totalSources(), |
||
137 | 'media' => $this->totalMediaObjects(), |
||
138 | 'repositories' => $this->totalRepositories(), |
||
139 | 'notes' => $this->totalNotes(), |
||
140 | 'individual_list_module' => $this->module_service->findByInterface(IndividualListModule::class)->first(), |
||
141 | 'family_list_module' => $this->module_service->findByInterface(FamilyListModule::class)->first(), |
||
142 | 'media_list_module' => $this->module_service->findByInterface(MediaListModule::class)->first(), |
||
143 | 'note_list_module' => $this->module_service->findByInterface(NoteListModule::class)->first(), |
||
144 | 'repository_list_module' => $this->module_service->findByInterface(RepositoryListModule::class)->first(), |
||
145 | 'source_list_module' => $this->module_service->findByInterface(SourceListModule::class)->first(), |
||
146 | 'files_to_delete' => $files_to_delete, |
||
147 | 'all_modules_disabled' => $this->module_service->all(true), |
||
148 | 'all_modules_enabled' => $this->module_service->all(), |
||
149 | 'deleted_modules' => $this->module_service->deletedModules(), |
||
150 | 'analytics_modules_disabled' => $this->module_service->findByInterface(ModuleAnalyticsInterface::class, true), |
||
151 | 'analytics_modules_enabled' => $this->module_service->findByInterface(ModuleAnalyticsInterface::class), |
||
152 | 'block_modules_disabled' => $this->module_service->findByInterface(ModuleBlockInterface::class, true), |
||
153 | 'block_modules_enabled' => $this->module_service->findByInterface(ModuleBlockInterface::class), |
||
154 | 'chart_modules_disabled' => $this->module_service->findByInterface(ModuleChartInterface::class, true), |
||
155 | 'chart_modules_enabled' => $this->module_service->findByInterface(ModuleChartInterface::class), |
||
156 | 'other_modules' => $this->module_service->otherModules(true), |
||
157 | 'footer_modules_disabled' => $this->module_service->findByInterface(ModuleFooterInterface::class, true), |
||
158 | 'footer_modules_enabled' => $this->module_service->findByInterface(ModuleFooterInterface::class), |
||
159 | 'history_modules_disabled' => $this->module_service->findByInterface(ModuleHistoricEventsInterface::class, true), |
||
160 | 'history_modules_enabled' => $this->module_service->findByInterface(ModuleHistoricEventsInterface::class), |
||
161 | 'language_modules_disabled' => $this->module_service->findByInterface(ModuleLanguageInterface::class, true), |
||
162 | 'language_modules_enabled' => $this->module_service->findByInterface(ModuleLanguageInterface::class), |
||
163 | 'list_modules_disabled' => $this->module_service->findByInterface(ModuleListInterface::class, true), |
||
164 | 'list_modules_enabled' => $this->module_service->findByInterface(ModuleListInterface::class), |
||
165 | 'menu_modules_disabled' => $this->module_service->findByInterface(ModuleMenuInterface::class, true), |
||
166 | 'menu_modules_enabled' => $this->module_service->findByInterface(ModuleMenuInterface::class), |
||
167 | 'report_modules_disabled' => $this->module_service->findByInterface(ModuleReportInterface::class, true), |
||
168 | 'report_modules_enabled' => $this->module_service->findByInterface(ModuleReportInterface::class), |
||
169 | 'sidebar_modules_disabled' => $this->module_service->findByInterface(ModuleSidebarInterface::class, true), |
||
170 | 'sidebar_modules_enabled' => $this->module_service->findByInterface(ModuleSidebarInterface::class), |
||
171 | 'tab_modules_disabled' => $this->module_service->findByInterface(ModuleTabInterface::class, true), |
||
172 | 'tab_modules_enabled' => $this->module_service->findByInterface(ModuleTabInterface::class), |
||
173 | 'theme_modules_disabled' => $this->module_service->findByInterface(ModuleThemeInterface::class, true), |
||
174 | 'theme_modules_enabled' => $this->module_service->findByInterface(ModuleThemeInterface::class), |
||
175 | ]); |
||
300 |