| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 1 | public function generator($data) { |
|
| 18 | 1 | if (count($data) <= 1) { |
|
| 19 | 1 | yield $data; |
|
| 20 | 1 | } else { |
|
| 21 | 1 | foreach (range(0, count($data) - 1) as $i) { |
|
| 22 | 1 | foreach ($this->generator(array_slice($data, 1)) as $item) { |
|
| 23 | 1 | yield array_merge(array_slice($item, 0, $i), array_slice($data, 0, 1), array_slice($item, $i)); |
|
| 24 | 1 | } |
|
| 25 | 1 | } |
|
| 26 | } |
||
| 27 | 1 | } |
|
| 28 | |||
| 31 |