APedigreeRecord   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getLike() 0 7 2
1
<?php
2
3
namespace kalanis\kw_pedigree\Storage;
4
5
6
use kalanis\kw_mapper\MapperException;
7
use kalanis\kw_mapper\Records\ASimpleRecord;
8
use kalanis\kw_pedigree\Interfaces\ILike;
9
use kalanis\kw_pedigree\PedigreeException;
10
11
12
/**
13
 * Class APedigreeRecord
14
 * @package kalanis\kw_pedigree\Storage
15
 * Shared abstract class necessary for correct access to data
16
 * @property int $id
17
 * @property string $name
18
 * @property string $short
19
 * @property string $family
20
 * @property string $birth
21
 * @property string $death
22
 * @property string $successes
23
 * @property string $sex
24
 * @property string $text
25
 */
26
abstract class APedigreeRecord extends ASimpleRecord
27
{
28
    /**
29
     * @param string $what
30
     * @param string|null $sex
31
     * @throws MapperException
32
     * @throws PedigreeException
33
     * @return APedigreeRecord[]
34
     */
35 7
    public function getLike(string $what, ?string $sex = null): array
36
    {
37 7
        $mapper = $this->getMapper();
38 7
        if ($mapper instanceof ILike) {
39 6
            return $mapper->getLike($this, $what, $sex);
40
        }
41 1
        throw new PedigreeException('Cannot get entries from source like that');
42
    }
43
}
44