Passed
Pull Request — master (#1821)
by Nico
52:02 queued 25:23
created

SingletonBattleParty::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Stu\Module\Ship\Lib\Battle\Party;
4
5
use Doctrine\Common\Collections\Collection;
6
use Stu\Module\Ship\Lib\ShipWrapperInterface;
7
8
class SingletonBattleParty extends AbstractBattleParty
9
{
10
    private bool $isBase;
11
12
    public function __construct(
13
        ShipWrapperInterface $leader
14
    ) {
15
        parent::__construct($leader);
16
17
        $this->isBase = $leader->get()->isBase();
18
    }
19
20
    public function initMembers(): Collection
21
    {
22
        return $this->createSingleton($this->leader);
23
    }
24
25
    public function isBase(): bool
26
    {
27
        return $this->isBase;
28
    }
29
}
30