Passed
Push — dev ( 91186a...20d5e2 )
by Janko
05:17
created

AstroStateWrapper   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 78.95%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 41
ccs 15
cts 19
cp 0.7895
rs 10
c 1
b 0
f 0
wmc 11

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getTurnsLeft() 0 3 1
A __construct() 0 1 1
A getType() 0 3 2
A getMeasurepointsLeft() 0 3 1
A isSystem() 0 3 1
A isPlannable() 0 3 1
A isDone() 0 3 1
A isMeasured() 0 3 1
A isPlanned() 0 3 1
A isFinishing() 0 3 1
1
<?php
2
3
namespace Stu\Module\Ship\View\ShowShip;
4
5
use Stu\Component\Ship\AstronomicalMappingStateEnum;
6
7
class AstroStateWrapper
8
{
9 2
    public function __construct(private AstronomicalMappingStateEnum $state, private ?int $turnsLeft, private bool $isSystem, private ?int $measurementpointsleft) {}
10
11 2
    public function isPlannable(): bool
12
    {
13 2
        return $this->state === AstronomicalMappingStateEnum::PLANNABLE;
14
    }
15 1
    public function isPlanned(): bool
16
    {
17 1
        return $this->state === AstronomicalMappingStateEnum::PLANNED;
18
    }
19 1
    public function isMeasured(): bool
20
    {
21 1
        return $this->state === AstronomicalMappingStateEnum::MEASURED;
22
    }
23 1
    public function isFinishing(): bool
24
    {
25 1
        return $this->state === AstronomicalMappingStateEnum::FINISHING;
26
    }
27 1
    public function isDone(): bool
28
    {
29 1
        return $this->state === AstronomicalMappingStateEnum::DONE;
30
    }
31
    public function getTurnsLeft(): ?int
32
    {
33
        return $this->turnsLeft;
34
    }
35
    public function getMeasurepointsLeft(): ?int
36
    {
37
        return $this->measurementpointsleft;
38
    }
39
40 2
    public function isSystem(): bool
41
    {
42 2
        return $this->isSystem;
43
    }
44
45 2
    public function getType(): string
46
    {
47 2
        return $this->isSystem() ? 'System' : 'Region';
48
    }
49
}
50