Feature   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isEnabled() 0 3 1
A __construct() 0 8 1
A strategies() 0 3 1
A id() 0 3 1
A jsonSerialize() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Pheature\Model\Toggle;
6
7
use Pheature\Core\Toggle\Read\Feature as IFeature;
8
use Pheature\Core\Toggle\Read\ToggleStrategies;
9
10
final class Feature implements IFeature
11
{
12
    private string $id;
13
    private ToggleStrategies $strategies;
14
    private bool $enabled;
15
16 2
    public function __construct(
17
        string $id,
18
        ToggleStrategies $strategies,
19
        bool $enabled
20
    ) {
21 2
        $this->id = $id;
22 2
        $this->strategies = $strategies;
23 2
        $this->enabled = $enabled;
24
    }
25
26 2
    public function id(): string
27
    {
28 2
        return $this->id;
29
    }
30
31 2
    public function strategies(): ToggleStrategies
32
    {
33 2
        return $this->strategies;
34
    }
35
36 2
    public function isEnabled(): bool
37
    {
38 2
        return $this->enabled;
39
    }
40
41
    public function jsonSerialize(): array
42
    {
43
        return [
44
            'id' => $this->id,
45
            'strategies' => $this->strategies->jsonSerialize(),
46
            'enabled' => $this->enabled,
47
        ];
48
    }
49
}
50