Passed
Push — master ( 3d9598...e4e562 )
by Nico
52:36 queued 23:35
created

AllianceListItem::__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
declare(strict_types=1);
4
5
namespace Stu\Module\Alliance\Lib;
6
7
use Stu\Orm\Entity\AllianceInterface;
8
use Stu\Orm\Entity\FactionInterface;
9
10
final class AllianceListItem
11
{
12
    private AllianceInterface $alliance;
13
14 1
    public function __construct(
15
        AllianceInterface $alliance
16
    ) {
17 1
        $this->alliance = $alliance;
18
    }
19
20
    public function getId(): int
21
    {
22
        return $this->alliance->getId();
23
    }
24
25
    public function getName(): string
26
    {
27
        return $this->alliance->getName();
28
    }
29
30
    public function getFaction(): ?FactionInterface
31
    {
32
        return $this->alliance->getFaction();
33
    }
34
35
    public function getMemberCount(): int
36
    {
37
        return count($this->alliance->getMembers());
38
    }
39
40
    public function acceptsApplications(): bool
41
    {
42
        return $this->alliance->getAcceptApplications() == 1;
43
    }
44
45
    public function hasAvatar(): bool
46
    {
47
        return $this->alliance->getAvatar() !== '';
48
    }
49
50
    public function getAvatar(): string
51
    {
52
        return $this->alliance->getAvatar();
53
    }
54
55
    public function getMembers(): iterable
56
    {
57
        return $this->alliance->getMembers();
58
    }
59
}
60