HistoryRatingDto   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 26
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 5 1
A __construct() 0 4 1
A level() 0 3 1
A nickname() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Game\Features\History;
6
7
use JsonSerializable;
8
9
/**
10
 * @psalm-immutable
11
 */
12
final class HistoryRatingDto implements JsonSerializable
13
{
14
    private int $level;
15
    private string $nickname;
16
17
    public function __construct(string $nickname, int $level)
18
    {
19
        $this->level = $level;
20
        $this->nickname = $nickname;
21
    }
22
23
    public function level(): int
24
    {
25
        return $this->level;
26
    }
27
28
    public function nickname(): string
29
    {
30
        return $this->nickname;
31
    }
32
33
    public function jsonSerialize(): array
34
    {
35
        return [
36
            'nickname' => $this->nickname,
37
            'level' => $this->level,
38
        ];
39
    }
40
}
41