Passed
Push — master ( c40ba3...9f651e )
by Pol
10:27 queued 08:40
created

Rebase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A on() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\collection\Operation;
6
7
use Closure;
8
use Generator;
9
use loophp\collection\Contract\Operation;
10
11
/**
12
 * Class Rebase.
13
 */
14
final class Rebase implements Operation
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function on(iterable $collection): Closure
20
    {
21
        return static function () use ($collection): Generator {
22
            foreach ($collection as $value) {
23
                yield $value;
24
            }
25
        };
26
    }
27
}
28