Passed
Push — dev ( f78319...bf5915 )
by Janko
05:17
created

ColonyDefendingBattleParty::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Stu\Module\Spacecraft\Lib\Battle\Party;
4
5
use Doctrine\Common\Collections\Collection;
6
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...
7
use Stu\Module\Spacecraft\Lib\Battle\SpacecraftAttackCauseEnum;
8
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
9
10
class ColonyDefendingBattleParty extends AbstractBattleParty implements AlertedBattlePartyInterface
11
{
12 2
    #[Override]
13
    public function initMembers(): Collection
14
    {
15 2
        $fleetWrapper = $this->leader->getFleetWrapper();
16
17 2
        if ($fleetWrapper === null) {
18 1
            return $this->createSingleton($this->leader);
19
        } else {
20
21
            // only uncloaked ships enter fight
22 1
            return $fleetWrapper->getShipWrappers()
23 1
                ->filter(fn(SpacecraftWrapperInterface $wrapper): bool => !$wrapper->get()->isCloaked());
24
        }
25
    }
26
27 1
    #[Override]
28
    public function getAttackCause(): SpacecraftAttackCauseEnum
29
    {
30 1
        return SpacecraftAttackCauseEnum::COLONY_DEFENSE;
31
    }
32
33 1
    #[Override]
34
    public function getAlertDescription(): string
35
    {
36 1
        return '[b][color=orange]Kolonie-Verteidigung[/color][/b]';
37
    }
38
}
39