@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function generate(array $elements, $subset_length) { |
| 82 | 82 | $length = \count($elements); |
| 83 | - if($subset_length === null){ |
|
| 83 | + if ($subset_length === null) { |
|
| 84 | 84 | $subset_length = $length; |
| 85 | 85 | } |
| 86 | - if($subset_length > $length){ |
|
| 86 | + if ($subset_length > $length) { |
|
| 87 | 87 | $subset_length = $length; |
| 88 | 88 | } |
| 89 | 89 | $pools = []; |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | $pools[] = $elements; |
| 92 | 92 | } |
| 93 | 93 | $productGenerator = $this->product($pools); |
| 94 | - foreach($productGenerator as $key => $indices){ |
|
| 94 | + foreach ($productGenerator as $key => $indices) { |
|
| 95 | 95 | $flipIndices = array_keys(array_flip($indices)); |
| 96 | - if(\count($flipIndices) == $subset_length){ |
|
| 96 | + if (\count($flipIndices) == $subset_length) { |
|
| 97 | 97 | $permute = []; |
| 98 | - foreach($indices as $k => $i){ |
|
| 98 | + foreach ($indices as $k => $i) { |
|
| 99 | 99 | $permute[] = $elements[$key[$k]]; |
| 100 | 100 | } |
| 101 | 101 | yield $key => $permute; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | public function toArray() { |
| 176 | 176 | $results = array(); |
| 177 | 177 | |
| 178 | - foreach($this->generator() as $value) { |
|
| 178 | + foreach ($this->generator() as $value) { |
|
| 179 | 179 | $results[] = $value; |
| 180 | 180 | } |
| 181 | 181 | |