AttackWithCard::number()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\Match\Command;
4
5
use Stratadox\CardGame\Command;
6
use Stratadox\CardGame\CorrelationId;
7
use Stratadox\CardGame\Match\MatchId;
8
9
final class AttackWithCard implements Command
10
{
11
    /** @var int */
12
    private $offset;
13
    /** @var int */
14
    private $player;
15
    /** @var MatchId */
16
    private $match;
17
    /** @var CorrelationId */
18
    private $correlationId;
19
20
    private function __construct(
21
        int $offset,
22
        int $player,
23
        MatchId $match,
24
        CorrelationId $correlationId
25
    ) {
26
        $this->offset = $offset;
27
        $this->player = $player;
28
        $this->match = $match;
29
        $this->correlationId = $correlationId;
30
    }
31
32
    public static function number(
33
        int $offset,
34
        int $player,
35
        MatchId $match,
36
        CorrelationId $correlationId
37
    ): self {
38
        return new self($offset, $player, $match, $correlationId);
39
    }
40
41
    public function cardNumber(): int
42
    {
43
        return $this->offset;
44
    }
45
46
    public function player(): int
47
    {
48
        return $this->player;
49
    }
50
51
    public function match(): MatchId
52
    {
53
        return $this->match;
54
    }
55
56
    public function correlationId(): CorrelationId
57
    {
58
        return $this->correlationId;
59
    }
60
}
61