Passed
Push — master ( 6f3564...5d9325 )
by Curtis
12:40
created

Fone   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 32
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A read() 0 38 1
1
<?php
2
3
namespace FamilyTree365\LaravelGedcom\Utils\Exporter\Indi\Name;
4
5
use FamilyTree365\LaravelGedcom\Models\PersonNameFone;
6
7
class Fone
8
{
9
    /**
10
     * \Gedcom\Record\Indi\Asso $asso
11
     * String $group
12
     * Integer $group_id.
13
     */
14
    public static function read($conn, \Gedcom\Record\Indi\Name\Fone $item, $group = '', $group_id = 0)
15
    {
16
        $type = $item->getType();
17
        $name = $item->getName();
18
        $npfx = $item->getNpfx();
19
        $givn = $item->getGivn();
20
        $nick = $item->getNick();
21
        $spfx = $item->getSpfx();
22
        $surn = $item->getSurn();
23
        $nsfx = $item->getNsfx();
24
25
        // store asso
26
        $key = [
27
            'group'=> $group,
28
            'gid'  => $group_id,
29
            'type' => $type,
30
            'name' => $name,
31
            'npfx' => $npfx,
32
            'givn' => $givn,
33
            'nick' => $nick,
34
            'spfx' => $spfx,
35
            'surn' => $surn,
36
            'nsfx' => $nsfx,
37
        ];
38
        $data = [
39
            'group'=> $group,
40
            'gid'  => $group_id,
41
            'type' => $type,
42
            'name' => $name,
43
            'npfx' => $npfx,
44
            'givn' => $givn,
45
            'nick' => $nick,
46
            'spfx' => $spfx,
47
            'surn' => $surn,
48
            'nsfx' => $nsfx,
49
        ];
50
51
        $record = PersonNameFone::on($conn)->updateOrCreate($key, $data);
0 ignored issues
show
Unused Code introduced by
The assignment to $record is dead and can be removed.
Loading history...
52
    }
53
}
54