Passed
Push — dev ( 2eb11f...3c2dab )
by Janko
09:11
created

SpacecraftSystemWrapper   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 39
ccs 10
cts 14
cp 0.7143
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A getGenericTemplate() 0 3 1
A getDescription() 0 3 1
A __construct() 0 5 1
A isActivated() 0 3 1
A isHealthy() 0 3 1
A getIcon() 0 3 1
1
<?php
2
3
namespace Stu\Component\Spacecraft\System;
4
5
use Stu\Orm\Entity\SpacecraftInterface;
6
use Stu\Orm\Entity\SpacecraftSystemInterface;
7
8
class SpacecraftSystemWrapper
9
{
10
    private SpacecraftSystemInterface $spacecraftSystem;
11
12 1
    public function __construct(
13
        SpacecraftInterface $spacecraft,
14
        private SpacecraftSystemTypeEnum $type
15
    ) {
16 1
        $this->spacecraftSystem = $spacecraft->getSpacecraftSystem($type);
17
    }
18
19
    public function get(): SpacecraftSystemInterface
20
    {
21
        return $this->spacecraftSystem;
22
    }
23
24 1
    public function isActivated(): bool
25
    {
26 1
        return $this->spacecraftSystem->getMode()->isActivated();
27
    }
28
29
    public function isHealthy(): bool
30
    {
31
        return $this->spacecraftSystem->isHealthy();
32
    }
33
34 1
    public function getGenericTemplate(): ?string
35
    {
36 1
        return $this->type->getGenericTemplate();
37
    }
38
39 1
    public function getIcon(): string
40
    {
41 1
        return $this->type->getIcon();
42
    }
43
44 1
    public function getDescription(): string
45
    {
46 1
        return $this->type->getDescription();
47
    }
48
}
49