Passed
Pull Request — master (#2043)
by Janko
20:39 queued 09:47
created

ShieldSystemData   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 70.83%

Importance

Changes 0
Metric Value
eloc 20
c 0
b 0
f 0
dl 0
loc 43
ccs 17
cts 24
cp 0.7083
rs 10
wmc 7

5 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
A getShieldRegenerationTimer() 0 3 1
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 getShieldRegenerationTimer(): int
22
    {
23
        return $this->shieldRegenerationTimer;
24
    }
25
26
    public function setShieldRegenerationTimer(int $timestamp): ShieldSystemData
27
    {
28
        $this->shieldRegenerationTimer = $timestamp;
29
30
        return $this;
31
    }
32
33 2
    public function getShieldStatusBar(): string
34
    {
35 2
        return $this->getStatusBar(
36 2
            _('Schilde'),
37 2
            $this->spacecraft->getShield(),
38 2
            $this->spacecraft->getMaxShield(),
39 2
            $this->spacecraft->getShieldState() ? StatusBarColorEnum::STATUSBAR_SHIELD_ON : StatusBarColorEnum::STATUSBAR_SHIELD_OFF
40 2
        )
41 2
            ->render();
42
    }
43
44 2
    public function getShieldStatusBarBig(): String
45
    {
46 2
        return $this->getStatusBar(
47 2
            _('Schilde'),
48 2
            $this->spacecraft->getShield(),
49 2
            $this->spacecraft->getMaxShield(),
50 2
            $this->spacecraft->getShieldState() ? StatusBarColorEnum::STATUSBAR_SHIELD_ON : StatusBarColorEnum::STATUSBAR_SHIELD_OFF
51 2
        )
52 2
            ->setSizeModifier(1.6)
53 2
            ->render();
54
    }
55
}
56