RpIteratorToArray   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 15
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Fakes;
4
5
use Iterator;
6
7
/**
8
 * Repetition which coverts iterator to array multiple times.
9
 * @template TKey
10
 * @template TValue
11
 * @extends RepetitionEnvelope<Iterator<TKey,TValue>, array<array<TKey, TValue>>>
12
 */
13
final class RpIteratorToArray extends RepetitionEnvelope
14
{
15
16
    /**
17
     * Ctor.
18
     *
19
     * @phpstan-param Iterator<TKey, TValue> $source
20
     * @param Iterator $source source iterator.
21
     */
22
    public function __construct(
23
        Iterator $source
24
    ) {
25
        parent::__construct(
26
            $source,
27
            fn (Iterator $source): array => iterator_to_array($source)
28
        );
29
    }
30
}
31