Compare   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 2 Features 0
Metric Value
eloc 5
c 3
b 2
f 0
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\collection\Operation;
6
7
use Closure;
8
use Generator;
9
10
/**
11
 * @immutable
12
 *
13
 * @template TKey
14
 * @template T
15
 */
16
final class Compare extends AbstractOperation
17
{
18
    /**
19
     * @return Closure(callable(T, T, TKey, iterable<TKey, T>): T): Closure(iterable<TKey, T>): Generator<TKey, T>
20
     */
21 26
    public function __invoke(): Closure
22
    {
23 26
        return
24
            /**
25
             * @param callable(T, T, TKey, iterable<TKey, T>): T $comparator
26
             *
27
             * @return Closure(iterable<TKey, T>): Generator<TKey,T>
28
             */
29 26
            static function (callable $comparator): Closure {
30
                /** @var Closure(iterable<TKey, T>): Generator<TKey, T> $foldLeft1 */
31 26
                $foldLeft1 = (new FoldLeft1())()($comparator);
32
33
                // Point free style.
34 26
                return $foldLeft1;
35 26
            };
36
    }
37
}
38