Test Failed
Push — dev ( cc891d...2da33f )
by Janko
09:11
created

ShieldSystemData   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 80.95%

Importance

Changes 0
Metric Value
eloc 19
c 0
b 0
f 0
dl 0
loc 38
ccs 17
cts 21
cp 0.8095
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSystemType() 0 4 1
A getShieldStatusBarBig() 0 10 2
A setShieldRegenerationTimer() 0 5 1
A getShieldStatusBar() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Spacecraft\System\Data;
6
7
use Override;
0 ignored issues
show
Bug introduced by
The type Override 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...
8
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum;
9
use Stu\Module\Template\StatusBarColorEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Module\Template\StatusBarColorEnum 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...
10
11
class ShieldSystemData extends AbstractSystemData
12
{
13
    public int $shieldRegenerationTimer = 0;
14
15
    #[Override]
16
    public function getSystemType(): SpacecraftSystemTypeEnum
17
    {
18
        return SpacecraftSystemTypeEnum::SHIELDS;
19
    }
20
21
    public function setShieldRegenerationTimer(int $timestamp): ShieldSystemData
22
    {
23
        $this->shieldRegenerationTimer = $timestamp;
24
25 2
        return $this;
26
    }
27 2
28 2
    public function getShieldStatusBar(): string
29 2
    {
30 2
        return $this->getStatusBar(
31 2
            _('Schilde'),
32 2
            $this->spacecraft->getShield(),
33 2
            $this->spacecraft->getMaxShield(),
34
            $this->spacecraft->getShieldState() ? StatusBarColorEnum::STATUSBAR_SHIELD_ON : StatusBarColorEnum::STATUSBAR_SHIELD_OFF
35
        )
36 2
            ->render();
37
    }
38 2
39 2
    public function getShieldStatusBarBig(): String
40 2
    {
41 2
        return $this->getStatusBar(
42 2
            _('Schilde'),
43 2
            $this->spacecraft->getShield(),
44 2
            $this->spacecraft->getMaxShield(),
45 2
            $this->spacecraft->getShieldState() ? StatusBarColorEnum::STATUSBAR_SHIELD_ON : StatusBarColorEnum::STATUSBAR_SHIELD_OFF
46
        )
47
            ->setSizeModifier(1.6)
48
            ->render();
49
    }
50
}
51