Passed
Pull Request — dev (#2044)
by Nico
11:37
created

AstroStateWrapper   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 36.84%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 41
ccs 7
cts 19
cp 0.3684
rs 10
c 0
b 0
f 0
wmc 11

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getTurnsLeft() 0 3 1
A isDone() 0 3 1
A isMeasured() 0 3 1
A isPlanned() 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 isFinishing() 0 3 1
1
<?php
2
3
namespace Stu\Module\Ship\View\ShowShip;
4
5
use Stu\Component\Ship\AstronomicalMappingEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Ship\AstronomicalMappingEnum was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class AstroStateWrapper
8
{
9 1
    public function __construct(private int $state, private ?int $turnsLeft, private bool $isSystem, private ?int $measurementpointsleft) {}
10
11 1
    public function isPlannable(): bool
12
    {
13 1
        return $this->state == AstronomicalMappingEnum::PLANNABLE;
14
    }
15
    public function isPlanned(): bool
16
    {
17
        return $this->state == AstronomicalMappingEnum::PLANNED;
18
    }
19
    public function isMeasured(): bool
20
    {
21
        return $this->state == AstronomicalMappingEnum::MEASURED;
22
    }
23
    public function isFinishing(): bool
24
    {
25
        return $this->state == AstronomicalMappingEnum::FINISHING;
26
    }
27
    public function isDone(): bool
28
    {
29
        return $this->state == AstronomicalMappingEnum::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 1
    public function isSystem(): bool
41
    {
42 1
        return $this->isSystem;
43
    }
44
45 1
    public function getType(): string
46
    {
47 1
        return $this->isSystem() ? 'System' : 'Region';
48
    }
49
}