| Conditions | 1 |
| Paths | 1 |
| Total Lines | 56 |
| Code Lines | 52 |
| 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 |
||
| 16 | protected function getFields(array $row): array |
||
| 17 | { |
||
| 18 | [ |
||
| 19 | $date, |
||
| 20 | $husband_name, |
||
| 21 | $husband_first_name, |
||
| 22 | $husband_father_first_name, |
||
| 23 | $husband_father_dead, |
||
| 24 | $husband_mother_name, |
||
| 25 | $husband_mother_first_name, |
||
| 26 | $husband_mother_dead, |
||
| 27 | $wife_name, |
||
| 28 | $wife_first_name, |
||
| 29 | $wife_father_first_name, |
||
| 30 | $wife_father_dead, |
||
| 31 | $wife_mother_name, |
||
| 32 | $wife_mother_first_name, |
||
| 33 | $wife_mother_dead, |
||
| 34 | $husband_obs, |
||
| 35 | $wife_obs, |
||
| 36 | $marriage_obs, |
||
| 37 | $husband_parent_obs, |
||
| 38 | $wife_parent_obs, |
||
| 39 | $parish, |
||
| 40 | $source, |
||
| 41 | $update, |
||
| 42 | $film, |
||
| 43 | $photos, |
||
| 44 | ] = $row['cell']; |
||
| 45 | |||
| 46 | return [ |
||
| 47 | 'date' => $date, |
||
| 48 | 'husband_name' => $husband_name, |
||
| 49 | 'husband_first_name' => $husband_first_name, |
||
| 50 | 'husband_father_first_name' => $husband_father_first_name, |
||
| 51 | 'husband_father_dead' => $husband_father_dead, |
||
| 52 | 'husband_mother_name' => $husband_mother_name, |
||
| 53 | 'husband_mother_first_name' => $husband_mother_first_name, |
||
| 54 | 'husband_mother_dead' => $husband_mother_dead, |
||
| 55 | 'wife_name' => $wife_name, |
||
| 56 | 'wife_first_name' => $wife_first_name, |
||
| 57 | 'wife_father_first_name' => $wife_father_first_name, |
||
| 58 | 'wife_father_dead' => $wife_father_dead, |
||
| 59 | 'wife_mother_name' => $wife_mother_name, |
||
| 60 | 'wife_mother_first_name' => $wife_mother_first_name, |
||
| 61 | 'wife_mother_dead' => $wife_mother_dead, |
||
| 62 | 'husband_obs' => $husband_obs, |
||
| 63 | 'wife_obs' => $wife_obs, |
||
| 64 | 'marriage_obs' => $marriage_obs, |
||
| 65 | 'husband_parent_obs' => $husband_parent_obs, |
||
| 66 | 'wife_parent_obs' => $wife_parent_obs, |
||
| 67 | 'parish' => $parish, |
||
| 68 | 'source' => $source, |
||
| 69 | 'update' => $update, |
||
| 70 | 'film' => $film, |
||
| 71 | 'photos' => $photos, |
||
| 72 | ]; |
||
| 75 |