PedigreeRecord   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 27
ccs 18
cts 18
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addEntries() 0 16 1
A getMapperClass() 0 3 1
1
<?php
2
3
namespace kalanis\kw_pedigree\Storage\SingleTable;
4
5
6
use kalanis\kw_mapper\Interfaces\IEntryType;
7
use kalanis\kw_pedigree\Interfaces\ISex;
8
use kalanis\kw_pedigree\Storage\APedigreeRecord;
9
10
11
/**
12
 * Class PedigreeRecord
13
 * @package kalanis\kw_pedigree\Storage\SingleTable
14
 * @property int|null $fatherId
15
 * @property int|null $motherId
16
 * @property PedigreeMapper[] $father
17
 * @property PedigreeMapper[] $mother
18
 */
19
class PedigreeRecord extends APedigreeRecord
20
{
21 8
    protected function addEntries(): void
22
    {
23 8
        $this->addEntry('id', IEntryType::TYPE_INTEGER, 65536);
24 8
        $this->addEntry('short', IEntryType::TYPE_STRING, 64);
25 8
        $this->addEntry('name', IEntryType::TYPE_STRING, 75);
26 8
        $this->addEntry('family', IEntryType::TYPE_STRING, 256);
27 8
        $this->addEntry('birth', IEntryType::TYPE_STRING, 32);
28 8
        $this->addEntry('death', IEntryType::TYPE_STRING, 32);
29 8
        $this->addEntry('fatherId', IEntryType::TYPE_INTEGER, 65536);
30 8
        $this->addEntry('motherId', IEntryType::TYPE_INTEGER, 65536);
31 8
        $this->addEntry('successes', IEntryType::TYPE_STRING, 1024);
32 8
        $this->addEntry('sex', IEntryType::TYPE_SET, [ISex::FEMALE, ISex::MALE]);
33 8
        $this->addEntry('text', IEntryType::TYPE_STRING, 8192);
34 8
        $this->addEntry('father', IEntryType::TYPE_ARRAY); // FK - makes the array of entries every time
35 8
        $this->addEntry('mother', IEntryType::TYPE_ARRAY); // FK - makes the array of entries every time
36 8
        $this->setMapper($this->getMapperClass());
37 8
    }
38
39
    /**
40
     * @return string
41
     * @codeCoverageIgnore used another one for testing
42
     */
43 1
    protected function getMapperClass(): string
44
    {
45 1
        return PedigreeMapper::class;
46
    }
47
}
48