Passed
Push — master ( cc891d...b53f20 )
by Nico
11:42
created

ShieldSystemData   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 77.27%

Importance

Changes 0
Metric Value
eloc 19
c 0
b 0
f 0
dl 0
loc 38
ccs 17
cts 22
cp 0.7727
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
        return $this;
26
    }
27
28 2
    public function getShieldStatusBar(): string
29
    {
30 2
        return $this->getStatusBar(
31 2
            _('Schilde'),
32 2
            $this->spacecraft->getShield(),
33 2
            $this->spacecraft->getMaxShield(),
34 2
            $this->spacecraft->getShieldState() ? StatusBarColorEnum::STATUSBAR_SHIELD_ON : StatusBarColorEnum::STATUSBAR_SHIELD_OFF
35 2
        )
36 2
            ->render();
37
    }
38
39 2
    public function getShieldStatusBarBig(): String
40
    {
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 2
        )
47 2
            ->setSizeModifier(1.6)
48 2
            ->render();
49
    }
50
}
51