LineDto   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 24
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A line() 0 3 1
A jsonSerialize() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Crossword\Features\Constructor;
6
7
use App\Crossword\Features\Constructor\Dictionary\Word;
8
use App\Crossword\Features\Constructor\Scanner\Grid\Line;
9
use JsonSerializable;
10
11
/**
12
 * @psalm-immutable
13
 */
14
final class LineDto implements JsonSerializable
15
{
16
    private Line $line;
17
    private Word $word;
18
19
    public function __construct(Line $line, Word $word)
20
    {
21
        $this->line = $line;
22
        $this->word = $word;
23
    }
24
25
    public function line(): Line
26
    {
27
        return $this->line;
28
    }
29
30
    /**
31
     * @psalm-suppress ImpureMethodCall
32
     */
33
    public function jsonSerialize(): array
34
    {
35
        return [
36
            'line' => $this->line->jsonSerialize(),
37
            'word' => $this->word->jsonSerialize(),
38
        ];
39
    }
40
}
41