StorageWordDtoCollection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 18
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getIterator() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Dictionary\Infrastructure\Repository\Elastic;
6
7
use ArrayIterator;
8
use IteratorAggregate;
9
10
/**
11
 * @psalm-immutable
12
 */
13
final class StorageWordDtoCollection implements IteratorAggregate
14
{
15
    /**
16
     * @var StorageWordDto[]
17
     */
18
    private array $words;
19
20
    public function __construct(array $words)
21
    {
22
        $this->words = array_map(
23
            static fn (array $attributes): StorageWordDto => new StorageWordDto($attributes),
24
            $words
25
        );
26
    }
27
28
    public function getIterator(): ArrayIterator
29
    {
30
        return new ArrayIterator($this->words);
31
    }
32
}
33