EntryAdapter   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 39
ccs 18
cts 18
cp 1
rs 10
wmc 9

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoadedRecord() 0 3 1
A getMotherId() 0 4 2
A getFatherId() 0 4 2
A setFatherId() 0 7 2
A setMotherId() 0 7 2
1
<?php
2
3
namespace kalanis\kw_pedigree\Storage\SingleTable;
4
5
6
use kalanis\kw_pedigree\PedigreeException;
7
use kalanis\kw_pedigree\Storage\AEntryAdapter;
8
use kalanis\kw_pedigree\Storage\APedigreeRecord;
9
10
11
/**
12
 * Class EntryAdapter
13
 * @package kalanis\kw_pedigree\Storage\SingleTable
14
 */
15
class EntryAdapter extends AEntryAdapter
16
{
17 1
    public function setFatherId(?int $fatherId): ?bool
18
    {
19 1
        if ($this->getLoadedRecord()->fatherId != $fatherId) {
0 ignored issues
show
Bug Best Practice introduced by
The property fatherId does not exist on kalanis\kw_pedigree\Storage\APedigreeRecord. Since you implemented __get, consider adding a @property annotation.
Loading history...
20 1
            $this->getLoadedRecord()->fatherId = $fatherId;
0 ignored issues
show
Bug Best Practice introduced by
The property fatherId does not exist on kalanis\kw_pedigree\Storage\APedigreeRecord. Since you implemented __set, consider adding a @property annotation.
Loading history...
21 1
            return true;
22
        }
23 1
        return null;
24
    }
25
26 1
    public function getFatherId(): ?int
27
    {
28 1
        $data = $this->getLoadedRecord()->fatherId;
0 ignored issues
show
Bug Best Practice introduced by
The property fatherId does not exist on kalanis\kw_pedigree\Storage\APedigreeRecord. Since you implemented __get, consider adding a @property annotation.
Loading history...
29 1
        return !is_null($data) ? intval($data) : null;
30
    }
31
32 1
    public function setMotherId(?int $motherId): ?bool
33
    {
34 1
        if ($this->getLoadedRecord()->motherId != $motherId) {
0 ignored issues
show
Bug Best Practice introduced by
The property motherId does not exist on kalanis\kw_pedigree\Storage\APedigreeRecord. Since you implemented __get, consider adding a @property annotation.
Loading history...
35 1
            $this->getLoadedRecord()->motherId = $motherId;
0 ignored issues
show
Bug Best Practice introduced by
The property motherId does not exist on kalanis\kw_pedigree\Storage\APedigreeRecord. Since you implemented __set, consider adding a @property annotation.
Loading history...
36 1
            return true;
37
        }
38 1
        return null;
39
    }
40
41 1
    public function getMotherId(): ?int
42
    {
43 1
        $data = $this->getLoadedRecord()->motherId;
0 ignored issues
show
Bug Best Practice introduced by
The property motherId does not exist on kalanis\kw_pedigree\Storage\APedigreeRecord. Since you implemented __get, consider adding a @property annotation.
Loading history...
44 1
        return !is_null($data) ? intval($data) : null;
45
    }
46
47
    /**
48
     * @throws PedigreeException
49
     * @return PedigreeRecord
50
     */
51 5
    public function getLoadedRecord(): APedigreeRecord
52
    {
53 5
        return parent::getLoadedRecord();
54
    }
55
}
56