Blood::bloodRh()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace DummyGenerator\Core;
6
7
use DummyGenerator\Definitions\Extension\Awareness\RandomizerAwareExtensionInterface;
8
use DummyGenerator\Definitions\Extension\Awareness\RandomizerAwareExtensionTrait;
9
use DummyGenerator\Definitions\Extension\BloodExtensionInterface;
10
11
class Blood implements BloodExtensionInterface, RandomizerAwareExtensionInterface
12
{
13
    use RandomizerAwareExtensionTrait;
14
15
    /** @var string[] */
16
    protected array $bloodTypes = ['A', 'AB', 'B', 'O'];
17
18
    /** @var string[] */
19
    protected array $bloodRhFactors = ['+', '-'];
20
21 2
    public function bloodType(): string
22
    {
23 2
        return $this->randomizer->randomElement($this->bloodTypes);
24
    }
25
26 2
    public function bloodRh(): string
27
    {
28 2
        return $this->randomizer->randomElement($this->bloodRhFactors);
29
    }
30
31 1
    public function bloodGroup(): string
32
    {
33 1
        return sprintf('%s%s', $this->bloodType(), $this->bloodRh());
34
    }
35
}
36