Test Failed
Push — master ( 85ca69...144c12 )
by Roman
15:41
created

ErrorDto::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Game\Application\Dto;
6
7
use JsonSerializable;
8
9
/**
10
 * @psalm-immutable
11
 */
12
final class ErrorDto implements JsonSerializable
13
{
14
    private string $code;
15
    private string $message;
16
    private array $data;
17
18
    public function __construct(string $code, string $message, array $data = [])
19
    {
20
        $this->code = $code;
21
        $this->message = $message;
22
        $this->data = $data;
23
    }
24
25
    public function jsonSerialize(): array
26
    {
27
        return [
28
            'code' => $this->code,
29
            'message' => $this->message,
30
            'data' => $this->data,
31
        ];
32
    }
33
}
34