Passed
Push — master ( 1fb483...35eebd )
by Roman
04:31
created

ErrorCriteria   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 19
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 6 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Crossword\Features\Languages\Response\Error;
6
7
use JsonSerializable;
8
9
/**
10
 * @psalm-immutable
11
 */
12
final class ErrorCriteria 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