Strict   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\collection\Operation;
6
7
use Closure;
8
use Generator;
9
use loophp\iterators\IterableIteratorAggregate;
10
use loophp\iterators\TypedIterableAggregate;
11
12
/**
13
 * @immutable
14
 *
15
 * @template TKey
16
 * @template T
17
 */
18
final class Strict extends AbstractOperation
19
{
20
    /**
21
     * @return Closure(null|callable(mixed): string): Closure(iterable<TKey, T>): Generator<TKey, T>
22
     */
23 4
    public function __invoke(): Closure
24
    {
25 4
        return
26
            /**
27
             * @param null|callable(mixed): string $callback
28
             *
29
             * @return Closure(iterable<TKey, T>): Generator<TKey, T>
30
             */
31 4
            static fn (?callable $callback = null): Closure =>
32
                /**
33
                 * @return Generator<TKey, T>
34
                 */
35 4
                static fn (iterable $iterator): Generator => yield from new TypedIterableAggregate((new IterableIteratorAggregate($iterator))->getIterator(), $callback);
36
    }
37
}
38