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

ErrorDto   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A jsonSerialize() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Dictionary\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