Conditions | 21 |
Paths | 2 |
Total Lines | 204 |
Code Lines | 192 |
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 |
||
255 | public function configureBlock($block_id) |
||
256 | { |
||
257 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
||
258 | $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update')); |
||
259 | $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames')); |
||
260 | $this->setBlockSetting($block_id, 'number_of_surnames', Filter::postInteger('number_of_surnames')); |
||
261 | $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi')); |
||
262 | $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam')); |
||
263 | $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour')); |
||
264 | $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other')); |
||
265 | $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media')); |
||
266 | $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo')); |
||
267 | $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname')); |
||
268 | $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events')); |
||
269 | $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users')); |
||
270 | $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth')); |
||
271 | $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth')); |
||
272 | $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death')); |
||
273 | $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death')); |
||
274 | $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life')); |
||
275 | $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life')); |
||
276 | $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil')); |
||
277 | $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil')); |
||
278 | } |
||
279 | |||
280 | $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); |
||
281 | $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1'); |
||
282 | $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES); |
||
283 | $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1'); |
||
284 | $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1'); |
||
285 | $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1'); |
||
286 | $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1'); |
||
287 | $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1'); |
||
288 | $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1'); |
||
289 | $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1'); |
||
290 | $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1'); |
||
291 | $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1'); |
||
292 | $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1'); |
||
293 | $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1'); |
||
294 | $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1'); |
||
295 | $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1'); |
||
296 | $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1'); |
||
297 | $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1'); |
||
298 | $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1'); |
||
299 | |||
300 | ?> |
||
301 | <tr> |
||
302 | <td class="descriptionbox wrap width33"> |
||
303 | <label for="show-last-update"> |
||
304 | <?php echo /* I18N: label for yes/no option */ I18N::translate('Show date of last update') ?> |
||
305 | </label> |
||
306 | </td> |
||
307 | <td class="optionbox"> |
||
308 | <input type="checkbox" value="yes" id="show-last-update" name="show_last_update" <?php echo $show_last_update ? 'checked' : ''; ?>> |
||
309 | </td> |
||
310 | </tr> |
||
311 | <tr> |
||
312 | <td class="descriptionbox wrap width33"> |
||
313 | <?php echo I18N::translate('Statistics'); ?> |
||
314 | </td> |
||
315 | <td class="optionbox"> |
||
316 | <table> |
||
317 | <tbody> |
||
318 | <tr> |
||
319 | <td> |
||
320 | <label> |
||
321 | <input type="checkbox" value="yes" name="stat_indi" <?php echo $stat_indi ? 'checked' : ''; ?>> |
||
322 | <?php echo I18N::translate('Individuals'); ?> |
||
323 | </label> |
||
324 | </td> |
||
325 | <td> |
||
326 | <label> |
||
327 | <input type="checkbox" value="yes" name="stat_first_birth" <?php echo $stat_first_birth ? 'checked' : ''; ?>> |
||
328 | <?php echo I18N::translate('Earliest birth year'); ?> |
||
329 | </label> |
||
330 | </td> |
||
331 | </tr> |
||
332 | <tr> |
||
333 | <td> |
||
334 | <label> |
||
335 | <input type="checkbox" value="yes" name="stat_surname" <?php echo $stat_surname ? 'checked' : ''; ?>> |
||
336 | <?php echo I18N::translate('Total surnames'); ?> |
||
337 | </label> |
||
338 | </td> |
||
339 | <td> |
||
340 | <label> |
||
341 | <input type="checkbox" value="yes" name="stat_last_birth" <?php echo $stat_last_birth ? 'checked' : ''; ?>> |
||
342 | <?php echo I18N::translate('Latest birth year'); ?> |
||
343 | </label> |
||
344 | </td> |
||
345 | </tr> |
||
346 | <tr> |
||
347 | <td> |
||
348 | <label> |
||
349 | <input type="checkbox" value="yes" name="stat_fam" <?php echo $stat_fam ? 'checked' : ''; ?>> |
||
350 | <?php echo I18N::translate('Families'); ?> |
||
351 | </label> |
||
352 | </td> |
||
353 | <td> |
||
354 | <label> |
||
355 | <input type="checkbox" value="yes" name="stat_first_death" <?php echo $stat_first_death ? 'checked' : ''; ?>> |
||
356 | <?php echo I18N::translate('Earliest death year'); ?> |
||
357 | </label> |
||
358 | </td> |
||
359 | </tr> |
||
360 | <tr> |
||
361 | <td> |
||
362 | <label> |
||
363 | <input type="checkbox" value="yes" name="stat_sour" <?php echo $stat_sour ? 'checked' : ''; ?>> |
||
364 | <?php echo I18N::translate('Sources'); ?> |
||
365 | </label> |
||
366 | </td> |
||
367 | <td> |
||
368 | <label> |
||
369 | <input type="checkbox" value="yes" name="stat_last_death" <?php echo $stat_last_death ? 'checked' : ''; ?>> |
||
370 | <?php echo I18N::translate('Latest death year'); ?> |
||
371 | </label> |
||
372 | </td> |
||
373 | </tr> |
||
374 | <tr> |
||
375 | <td> |
||
376 | <label> |
||
377 | <input type="checkbox" value="yes" name="stat_media" <?php echo $stat_media ? 'checked' : ''; ?>> |
||
378 | <?php echo I18N::translate('Media objects'); ?> |
||
379 | </label> |
||
380 | </td> |
||
381 | <td> |
||
382 | <label> |
||
383 | <input type="checkbox" value="yes" name="stat_long_life" <?php echo $stat_long_life ? 'checked' : ''; ?>> |
||
384 | <?php echo I18N::translate('Individual who lived the longest'); ?> |
||
385 | </label> |
||
386 | </td> |
||
387 | </tr> |
||
388 | <tr> |
||
389 | <td> |
||
390 | <label> |
||
391 | <input type="checkbox" value="yes" name="stat_repo" <?php echo $stat_repo ? 'checked' : ''; ?>> |
||
392 | <?php echo I18N::translate('Repositories'); ?> |
||
393 | </label> |
||
394 | </td> |
||
395 | <td> |
||
396 | <label> |
||
397 | <input type="checkbox" value="yes" name="stat_avg_life" <?php echo $stat_avg_life ? 'checked' : ''; ?>> |
||
398 | <?php echo I18N::translate('Average age at death'); ?> |
||
399 | </label> |
||
400 | </td> |
||
401 | </tr> |
||
402 | <tr> |
||
403 | <td> |
||
404 | <label> |
||
405 | <input type="checkbox" value="yes" name="stat_events" <?php echo $stat_events ? 'checked' : ''; ?>> |
||
406 | <?php echo I18N::translate('Total events'); ?> |
||
407 | </label> |
||
408 | </td> |
||
409 | <td> |
||
410 | <label> |
||
411 | <input type="checkbox" value="yes" name="stat_most_chil" <?php echo $stat_most_chil ? 'checked' : ''; ?>> |
||
412 | <?php echo I18N::translate('Family with the most children'); ?> |
||
413 | </label> |
||
414 | </td> |
||
415 | </tr> |
||
416 | <tr> |
||
417 | <td> |
||
418 | <label> |
||
419 | <input type="checkbox" value="yes" name="stat_users" <?php echo $stat_users ? 'checked' : ''; ?>> |
||
420 | <?php echo I18N::translate('Total users'); ?> |
||
421 | </label> |
||
422 | </td> |
||
423 | <td> |
||
424 | <label> |
||
425 | <input type="checkbox" value="yes" name="stat_avg_chil" <?php echo $stat_avg_chil ? 'checked' : ''; ?>> |
||
426 | <?php echo I18N::translate('Average number of children per family'); ?> |
||
427 | </label> |
||
428 | </td> |
||
429 | </tr> |
||
430 | </tbody> |
||
431 | </table> |
||
432 | </td> |
||
433 | </tr> |
||
434 | <tr> |
||
435 | <td class="descriptionbox wrap width33"> |
||
436 | <label for="show-common-surnames"> |
||
437 | <?php echo I18N::translate('Most common surnames') ?> |
||
438 | </label> |
||
439 | </td> |
||
440 | <td class="optionbox"> |
||
441 | <input type="checkbox" value="yes" id="show-common-surnames" name="show_common_surnames" <?php echo $show_common_surnames ? 'checked' : ''; ?>> |
||
442 | </td> |
||
443 | </tr> |
||
444 | <tr> |
||
445 | <td class="descriptionbox wrap width33"> |
||
446 | <label for="number-of-surnames"> |
||
447 | <?php echo /* I18N: ... to show in a list */ I18N::translate('Number of surnames') ?> |
||
448 | </label> |
||
449 | </td> |
||
450 | <td class="optionbox"> |
||
451 | <input |
||
452 | id="number-of-surnames" |
||
453 | maxlength="5" |
||
454 | name="number_of_surnames" |
||
455 | pattern="[1-9][0-9]*" |
||
456 | required |
||
457 | type="text" |
||
458 | value="<?php echo Filter::escapeHtml($number_of_surnames); ?>" |
||
459 | > |
||
465 |