Conditions | 1 |
Paths | 1 |
Total Lines | 65 |
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 |
||
154 | public function createTaskFilter(Container $container) |
||
155 | { |
||
156 | $container['taskQuery'] = $container->factory(function ($c) { |
||
157 | $builder = new QueryBuilder(); |
||
158 | $builder->withQuery($c['taskFinderModel']->getExtendedQuery()); |
||
159 | |||
160 | return $builder; |
||
161 | }); |
||
162 | |||
163 | $container['taskLexer'] = $container->factory(function ($c) { |
||
164 | $builder = new LexerBuilder(); |
||
165 | |||
166 | $builder |
||
167 | ->withQuery($c['taskFinderModel']->getExtendedQuery()) |
||
168 | ->withFilter(TaskAssigneeFilter::getInstance() |
||
169 | ->setCurrentUserId($c['userSession']->getId()) |
||
170 | ) |
||
171 | ->withFilter(new TaskCategoryFilter()) |
||
172 | ->withFilter(TaskColorFilter::getInstance() |
||
173 | ->setColorModel($c['colorModel']) |
||
174 | ) |
||
175 | ->withFilter(new TaskPriorityFilter()) |
||
176 | ->withFilter(new TaskColumnFilter()) |
||
177 | ->withFilter(new TaskCommentFilter()) |
||
178 | ->withFilter(TaskCreationDateFilter::getInstance() |
||
179 | ->setDateParser($c['dateParser']) |
||
180 | ) |
||
181 | ->withFilter(TaskCreatorFilter::getInstance() |
||
182 | ->setCurrentUserId($c['userSession']->getId()) |
||
183 | ) |
||
184 | ->withFilter(new TaskDescriptionFilter()) |
||
185 | ->withFilter(TaskDueDateFilter::getInstance() |
||
186 | ->setDateParser($c['dateParser']) |
||
187 | ) |
||
188 | ->withFilter(TaskStartDateFilter::getInstance() |
||
189 | ->setDateParser($c['dateParser']) |
||
190 | ) |
||
191 | ->withFilter(new TaskIdFilter()) |
||
192 | ->withFilter(TaskLinkFilter::getInstance() |
||
193 | ->setDatabase($c['db']) |
||
194 | ) |
||
195 | ->withFilter(TaskModificationDateFilter::getInstance() |
||
196 | ->setDateParser($c['dateParser']) |
||
197 | ) |
||
198 | ->withFilter(TaskMovedDateFilter::getInstance() |
||
199 | ->setDateParser($c['dateParser']) |
||
200 | ) |
||
201 | ->withFilter(new TaskProjectFilter()) |
||
202 | ->withFilter(new TaskReferenceFilter()) |
||
203 | ->withFilter(new TaskStatusFilter()) |
||
204 | ->withFilter(TaskSubtaskAssigneeFilter::getInstance() |
||
205 | ->setCurrentUserId($c['userSession']->getId()) |
||
206 | ->setDatabase($c['db']) |
||
207 | ) |
||
208 | ->withFilter(new TaskSwimlaneFilter()) |
||
209 | ->withFilter(TaskTagFilter::getInstance() |
||
210 | ->setDatabase($c['db']) |
||
211 | ) |
||
212 | ->withFilter(new TaskTitleFilter(), true); |
||
213 | |||
214 | return $builder; |
||
215 | }); |
||
216 | |||
217 | return $container; |
||
218 | } |
||
219 | } |
||
220 |