| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 62 |
| 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 | $family, |
||
| 20 | $number, |
||
| 21 | $notary_name, |
||
| 22 | $notary_first_name, |
||
| 23 | $type, |
||
| 24 | $date, |
||
| 25 | $name_a, |
||
| 26 | $first_name_a, |
||
| 27 | $a_dead, |
||
| 28 | $father_first_name_a, |
||
| 29 | $father_dead_a, |
||
| 30 | $mother_name_a, |
||
| 31 | $mother_first_name_a, |
||
| 32 | $mother_dead_a, |
||
| 33 | $name_b, |
||
| 34 | $first_name_b, |
||
| 35 | $b_dead, |
||
| 36 | $father_first_name_b, |
||
| 37 | $father_dead_b, |
||
| 38 | $mother_name_b, |
||
| 39 | $mother_first_name_b, |
||
| 40 | $mother_dead_b, |
||
| 41 | $note1, |
||
| 42 | $note2, |
||
| 43 | $note3, |
||
| 44 | $note4, |
||
| 45 | $note5, |
||
| 46 | $note6, |
||
| 47 | $note7, |
||
| 48 | $update, |
||
| 49 | ] = $row['cell']; |
||
| 50 | |||
| 51 | return [ |
||
| 52 | 'family' => $family, |
||
| 53 | 'number' => $number, |
||
| 54 | 'notary_name' => $notary_name, |
||
| 55 | 'notary_first_name' => $notary_first_name, |
||
| 56 | 'type' => $type, |
||
| 57 | 'date' => $date, |
||
| 58 | 'name_a' => $name_a, |
||
| 59 | 'first_name_a' => $first_name_a, |
||
| 60 | 'a_dead' => $a_dead, |
||
| 61 | 'father_first_name_a' => $father_first_name_a, |
||
| 62 | 'father_dead_a' => $father_dead_a, |
||
| 63 | 'mother_name_a' => $mother_name_a, |
||
| 64 | 'mother_first_name_a' => $mother_first_name_a, |
||
| 65 | 'mother_dead_a' => $mother_dead_a, |
||
| 66 | 'name_b' => $name_b, |
||
| 67 | 'first_name_b' => $first_name_b, |
||
| 68 | 'b_dead' => $b_dead, |
||
| 69 | 'father_first_name_b' => $father_first_name_b, |
||
| 70 | 'father_dead_b' => $father_dead_b, |
||
| 71 | 'mother_name_b' => $mother_name_b, |
||
| 72 | 'mother_first_name_b' => $mother_first_name_b, |
||
| 73 | 'mother_dead_b' => $mother_dead_b, |
||
| 74 | 'note1' => $note1, |
||
| 75 | 'note2' => $note2, |
||
| 76 | 'note3' => $note3, |
||
| 77 | 'note4' => $note4, |
||
| 78 | 'note5' => $note5, |
||
| 79 | 'note6' => $note6, |
||
| 80 | 'note7' => $note7, |
||
| 81 | 'update' => $update, |
||
| 82 | ]; |
||
| 85 |