Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | final class Permutate implements Operation |
||
19 | { |
||
20 | /** |
||
21 | * {@inheritdoc} |
||
22 | */ |
||
23 | 1 | public function on(iterable $collection): Closure |
|
24 | { |
||
25 | $getPermutate = function (array $dataset): Generator { |
||
26 | 1 | return $this->getPermutations($dataset); |
|
27 | 1 | }; |
|
28 | |||
29 | return static function () use ($collection, $getPermutate): Generator { |
||
30 | 1 | yield from $getPermutate((new All())->on($collection)); |
|
31 | 1 | }; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param array<mixed> $dataset |
||
36 | * |
||
37 | * @return Generator<array<mixed>> |
||
38 | */ |
||
39 | 1 | private function getPermutations(array $dataset): Generator |
|
56 | } |
||
57 | } |
||
60 |