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

AllianceListItem   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 11.11%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 48
ccs 2
cts 18
cp 0.1111
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 3 1
A acceptsApplications() 0 3 1
A getMembers() 0 3 1
A getAvatar() 0 3 1
A getId() 0 3 1
A getMemberCount() 0 3 1
A hasAvatar() 0 3 1
A getFaction() 0 3 1
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