Passed
Push — master ( e661f4...30021e )
by Nico
25:16 queued 10:59
created

Matchup   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 20
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefenders() 0 3 1
A isAttackingShieldsOnly() 0 3 1
A getAttacker() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Spacecraft\Lib\Battle;
6
7
use Stu\Module\Spacecraft\Lib\Battle\Party\BattlePartyInterface;
8
use Stu\Module\Spacecraft\Lib\Battle\Party\RoundBasedBattleParty;
9
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
10
11
class Matchup
12
{
13 5
    public function __construct(
14
        private RoundBasedBattleParty $battleParty,
15
        private BattlePartyInterface $targetParty
16 5
    ) {}
17
18 3
    public function getAttacker(): SpacecraftWrapperInterface
19
    {
20 3
        return $this->battleParty->getRandomUnused();
21
    }
22
23 5
    public function getDefenders(): BattlePartyInterface
24
    {
25 5
        return $this->targetParty;
26
    }
27
28
    public function isAttackingShieldsOnly(): bool
29
    {
30
        return $this->battleParty->get()->isAttackingShieldsOnly();
31
    }
32
}
33