Conditions | 1 |
Paths | 1 |
Total Lines | 219 |
Code Lines | 171 |
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 |
||
120 | $author, |
||
121 | $this->createMock(LoggerInterface::class), |
||
122 | $authorUuid, |
||
123 | 'Edit author service' |
||
124 | ], |
||
125 | [ |
||
126 | DeleteAuthor::class, |
||
127 | 'delete', |
||
128 | true, |
||
129 | $this->getMockForAbstractClass(AbstractAuthorRepository::class), |
||
130 | $author, |
||
131 | $this->createMock(LoggerInterface::class), |
||
132 | true, |
||
133 | 'Delete author service' |
||
134 | ], |
||
135 | [ |
||
136 | GetAuthor::class, |
||
137 | 'get', |
||
138 | $author, |
||
139 | $this->getMockForAbstractClass(AbstractAuthorRepository::class), |
||
140 | $authorUuid, |
||
141 | $this->createMock(LoggerInterface::class), |
||
142 | $author, |
||
143 | 'Get author service' |
||
144 | ], |
||
145 | [ |
||
146 | ListAuthors::class, |
||
147 | 'getList', |
||
148 | [$author], |
||
149 | $this->getMockForAbstractClass(AbstractAuthorRepository::class), |
||
150 | $filters, |
||
151 | $this->createMock(LoggerInterface::class), |
||
152 | [$author], |
||
153 | 'List authors service' |
||
154 | ], |
||
155 | [ |
||
156 | CreatePost::class, |
||
157 | 'save', |
||
158 | $postUuid, |
||
159 | $this->getMockForAbstractClass(AbstractPostRepository::class), |
||
160 | $post, |
||
161 | $this->createMock(LoggerInterface::class), |
||
162 | $postUuid, |
||
163 | 'Create post service' |
||
164 | ], |
||
165 | [ |
||
166 | EditPost::class, |
||
167 | 'save', |
||
168 | $postUuid, |
||
169 | $this->getMockForAbstractClass(AbstractPostRepository::class), |
||
170 | $post, |
||
171 | $this->createMock(LoggerInterface::class), |
||
172 | $postUuid, |
||
173 | 'Edit post service' |
||
174 | ], |
||
175 | [ |
||
176 | DeletePost::class, |
||
177 | 'delete', |
||
178 | true, |
||
179 | $this->getMockForAbstractClass(AbstractPostRepository::class), |
||
180 | $post, |
||
181 | $this->createMock(LoggerInterface::class), |
||
182 | true, |
||
183 | 'Delete post service' |
||
184 | ], |
||
185 | [ |
||
186 | GetPost::class, |
||
187 | 'get', |
||
188 | $post, |
||
189 | $this->getMockForAbstractClass(AbstractPostRepository::class), |
||
190 | $postUuid, |
||
191 | $this->createMock(LoggerInterface::class), |
||
192 | $post, |
||
193 | 'Get post service' |
||
194 | ], |
||
195 | [ |
||
196 | ListPosts::class, |
||
197 | 'getList', |
||
198 | [$post], |
||
199 | $this->getMockForAbstractClass(AbstractPostRepository::class), |
||
200 | $filters, |
||
201 | $this->createMock(LoggerInterface::class), |
||
202 | [$post], |
||
203 | 'List posts service' |
||
204 | ], |
||
205 | [ |
||
206 | CreateTag::class, |
||
207 | 'save', |
||
208 | $tagUuid, |
||
209 | $this->getMockForAbstractClass(AbstractTagRepository::class), |
||
210 | $tag, |
||
211 | $this->createMock(LoggerInterface::class), |
||
212 | $tagUuid, |
||
213 | 'Create tag service' |
||
214 | ], |
||
215 | [ |
||
216 | EditTag::class, |
||
217 | 'save', |
||
218 | $tagUuid, |
||
219 | $this->getMockForAbstractClass(AbstractTagRepository::class), |
||
220 | $tag, |
||
221 | $this->createMock(LoggerInterface::class), |
||
222 | $tagUuid, |
||
223 | 'Edit tag service' |
||
224 | ], |
||
225 | [ |
||
226 | DeleteTag::class, |
||
227 | 'delete', |
||
228 | true, |
||
229 | $this->getMockForAbstractClass(AbstractTagRepository::class), |
||
230 | $tag, |
||
231 | $this->createMock(LoggerInterface::class), |
||
232 | true, |
||
233 | 'Delete tag service' |
||
234 | ], |
||
235 | [ |
||
236 | GetTag::class, |
||
237 | 'get', |
||
238 | $tag, |
||
239 | $this->getMockForAbstractClass(AbstractTagRepository::class), |
||
240 | $tagUuid, |
||
241 | $this->createMock(LoggerInterface::class), |
||
242 | $tag, |
||
243 | 'Get tag service' |
||
244 | ], |
||
245 | [ |
||
246 | ListTags::class, |
||
247 | 'getList', |
||
248 | [$tag], |
||
249 | $this->getMockForAbstractClass(AbstractTagRepository::class), |
||
250 | $filters, |
||
251 | $this->createMock(LoggerInterface::class), |
||
252 | [$tag], |
||
253 | 'List tags service' |
||
254 | ], |
||
255 | [ |
||
256 | CreateTrail::class, |
||
257 | 'save', |
||
258 | $trailUuid, |
||
259 | $this->getMockForAbstractClass(AbstractTrailRepository::class), |
||
260 | $trail, |
||
261 | $this->createMock(LoggerInterface::class), |
||
262 | $trailUuid, |
||
263 | 'Create trail service' |
||
264 | ], |
||
265 | [ |
||
266 | EditTrail::class, |
||
267 | 'save', |
||
268 | $trailUuid, |
||
269 | $this->getMockForAbstractClass(AbstractTrailRepository::class), |
||
270 | $trail, |
||
271 | $this->createMock(LoggerInterface::class), |
||
272 | $trailUuid, |
||
273 | 'Edit trail service' |
||
274 | ], |
||
275 | [ |
||
276 | DeleteTrail::class, |
||
277 | 'delete', |
||
278 | true, |
||
279 | $this->getMockForAbstractClass(AbstractTrailRepository::class), |
||
280 | $trail, |
||
281 | $this->createMock(LoggerInterface::class), |
||
282 | true, |
||
283 | 'Delete trail service' |
||
284 | ], |
||
285 | [ |
||
286 | GetTrail::class, |
||
287 | 'get', |
||
288 | $trail, |
||
289 | $this->getMockForAbstractClass(AbstractTrailRepository::class), |
||
290 | $trailUuid, |
||
291 | $this->createMock(LoggerInterface::class), |
||
292 | $trail, |
||
293 | 'Get trail service' |
||
294 | ], |
||
295 | [ |
||
296 | ListTrails::class, |
||
297 | 'getList', |
||
298 | [$trail], |
||
299 | $this->getMockForAbstractClass(AbstractTrailRepository::class), |
||
300 | $filters, |
||
301 | $this->createMock(LoggerInterface::class), |
||
302 | [$trail], |
||
303 | 'List trails service' |
||
304 | ], |
||
305 | [ |
||
306 | DeleteAuthor::class, |
||
307 | 'delete', |
||
308 | false, |
||
309 | $this->getMockForAbstractClass(AbstractAuthorRepository::class), |
||
310 | $author, |
||
311 | $this->createMock(LoggerInterface::class), |
||
312 | false, |
||
313 | 'Delete author service' |
||
314 | ], |
||
315 | [ |
||
316 | GetAuthor::class, |
||
317 | 'get', |
||
318 | null, |
||
319 | $this->getMockForAbstractClass(AbstractAuthorRepository::class), |
||
320 | $authorUuid, |
||
321 | $this->createMock(LoggerInterface::class), |
||
322 | null, |
||
323 | 'Get author service' |
||
324 | ], |
||
325 | [ |
||
326 | ListAuthors::class, |
||
327 | 'getList', |
||
328 | [], |
||
329 | $this->getMockForAbstractClass(AbstractAuthorRepository::class), |
||
330 | $filters, |
||
331 | $this->createMock(LoggerInterface::class), |
||
332 | [], |
||
333 | 'List authors service' |
||
334 | ], |
||
335 | [ |
||
336 | DeletePost::class, |
||
337 | 'delete', |
||
338 | false, |
||
339 | $this->getMockForAbstractClass(AbstractPostRepository::class), |
||
625 |