SyncMarriages::getFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 56
Code Lines 52

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 52
nc 1
nop 1
dl 0
loc 56
rs 9.0472
c 0
b 0
f 0

How to fix   Long Method   

Long Method

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:

1
<?php
2
3
namespace App\Jobs\Geneanum\Malta;
4
5
use App\Jobs\Geneanum\Sync;
6
7
class SyncMarriages extends Sync
8
{
9
    protected const AREA = 'Malta';
10
    protected const DATABASE = 'Marriages';
11
    protected const URL = 'https://static.geneanum.com/libs/grid/malte_mariage.php?annee_limite=75&_search=false&nd=%s&rows=100&page=%s&sidx=date_union_en&sord=asc';
12
13
    /**
14
     * @inheritDoc
15
     */
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
        ];
73
    }
74
}
75