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

PlayerDto   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 25
ccs 0
cts 11
cp 0
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Game\Features\Authorization;
6
7
use JsonSerializable;
8
use Symfony\Component\Uid\UuidV4;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Uid\UuidV4 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * @psalm-immutable
12
 */
13
final class PlayerDto implements JsonSerializable
14
{
15
    private int $level;
16
    private string $role;
17
    private string $nickname;
18
    private UuidV4 $playerId;
19
20
    public function __construct(UuidV4 $playerId, string $nickname, int $level, string $role)
21
    {
22
        $this->playerId = $playerId;
23
        $this->role = $role;
24
        $this->level = $level;
25
        $this->nickname = $nickname;
26
    }
27
28
    /**
29
     * @psalm-suppress ImpureMethodCall
30
     */
31
    public function jsonSerialize(): array
32
    {
33
        return [
34
            'id' => $this->playerId->toRfc4122(),
35
            'nickname' => $this->nickname,
36
            'level' => $this->level,
37
            'role' => $this->role,
38
        ];
39
    }
40
}
41