SyncNotaries::getFields()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 66
Code Lines 62

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 62
nc 1
nop 1
dl 0
loc 66
rs 8.829
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 SyncNotaries extends Sync
8
{
9
    protected const AREA = 'Malta';
10
    protected const DATABASE = 'Notarial Acts';
11
    protected const URL = 'https://static.geneanum.com/libs/grid/malte_notaire.php?annee_limite=75&_search=false&nd=%s&rows=100&page=%s&sidx=famille&sord=asc';
12
13
    /**
14
     * @inheritDoc
15
     */
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
        ];
83
    }
84
}
85