Test Setup Failed
Push — master ( a63fa0...36623d )
by Jesse
04:59
created

Card   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A offset() 0 3 1
A attack() 0 3 1
A isAttacking() 0 3 1
A isDefending() 0 3 1
A hasTemplate() 0 3 1
A __construct() 0 4 1
A regroup() 0 3 1
A defend() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\ReadModel\Match;
4
5
final class Card
6
{
7
    /** @var int */
8
    private $offset;
9
    /** @var CardTemplate */
10
    private $template;
11
    /** @var bool */
12
    private $isAttacking = false;
13
    /** @var bool */
14
    private $isDefending = false;
15
16
    public function __construct(int $offset, CardTemplate $template)
17
    {
18
        $this->offset = $offset;
19
        $this->template = $template;
20
    }
21
22
    public function isAttacking(): bool
23
    {
24
        return $this->isAttacking;
25
    }
26
27
    public function isDefending(): bool
28
    {
29
        return $this->isDefending;
30
    }
31
32
    public function hasTemplate(CardTemplate $template): bool
33
    {
34
        return $this->template->is($template);
35
    }
36
37
    public function offset(): int
38
    {
39
        return $this->offset;
40
    }
41
42
    public function attack(): void
43
    {
44
        $this->isAttacking = true;
45
    }
46
47
    public function defend(): void
48
    {
49
        $this->isDefending = true;
50
    }
51
52
    public function regroup(): void
53
    {
54
        $this->isAttacking = false;
55
    }
56
}
57