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

Card::isDefending()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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