Passed
Pull Request — master (#2310)
by
unknown
17:04 queued 11:52
created

IncomingBattleParty::__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 Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
7
8
class IncomingBattleParty extends AbstractBattleParty
9
{
10 9
    #[\Override]
11
    public function initMembers(): Collection
12
    {
13 9
        $fleetWrapper = $this->leader->getFleetWrapper();
14
15 9
        $result = $fleetWrapper === null ? $this->createSingleton($this->leader) : $fleetWrapper->getShipWrappers();
16
17
        // filter warped and cloaked
18 9
        return $result
19 9
            ->filter(fn(SpacecraftWrapperInterface $wrapper): bool =>
20 9
            !$wrapper->get()->isCloaked() && !$wrapper->get()->isWarped());
21
    }
22
}
23