Blood   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A bloodType() 0 3 1
A bloodGroup() 0 3 1
A bloodRh() 0 3 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