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

PlayerDto::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 10
c 1
b 0
f 0
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