Passed
Push — master ( 35eebd...7b8a1a )
by Roman
16:45
created

History   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 47
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A changeLevel() 0 5 1
A __construct() 0 5 1
A level() 0 3 1
A createdAt() 0 3 1
A updatedAt() 0 3 1
A historyId() 0 3 1
A changePlayer() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Game\Features\History;
6
7
use DateTimeImmutable;
8
9
final class History
10
{
11
    private HistoryId $historyId;
12
    private PlayerId $playerId;
13
    private DateTimeImmutable $createdAt;
14
    private DateTimeImmutable $updatedAt;
15
    private int $level;
16
17
    public function __construct(HistoryId $historyId)
18
    {
19
        $this->historyId = $historyId;
20
        $this->createdAt = new DateTimeImmutable();
21
        $this->updatedAt = new DateTimeImmutable();
22
    }
23
24
    public function changeLevel(int $level): void
25
    {
26
        $this->level = $level;
27
28
        $this->updatedAt = new DateTimeImmutable();
29
    }
30
31
    public function changePlayer(PlayerId $playerId): void
32
    {
33
        $this->playerId = $playerId;
34
35
        $this->updatedAt = new DateTimeImmutable();
36
    }
37
38
    public function historyId(): HistoryId
39
    {
40
        return $this->historyId;
41
    }
42
43
    public function level(): int
44
    {
45
        return $this->level;
46
    }
47
48
    public function createdAt(): DateTimeImmutable
49
    {
50
        return $this->createdAt;
51
    }
52
53
    public function updatedAt(): DateTimeImmutable
54
    {
55
        return $this->updatedAt;
56
    }
57
}
58