@@ -91,7 +91,7 @@ |
||
| 91 | 91 | foreach (new Combinations($items, $this->getLength()) as $dataset) { |
| 92 | 92 | if (empty($dataset)) { |
| 93 | 93 | $return = array($perms); |
| 94 | - } else { |
|
| 94 | + } else { |
|
| 95 | 95 | $return = array(); |
| 96 | 96 | for ($i = count($dataset) - 1; $i >= 0; --$i) { |
| 97 | 97 | $newitems = $dataset; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @return int |
| 24 | 24 | */ |
| 25 | 25 | public function count() { |
| 26 | - return $this->fact(count($this->getDataset()))/$this->fact(count($this->getDataset()) - $this->getLength()); |
|
| 26 | + return $this->fact(count($this->getDataset())) / $this->fact(count($this->getDataset()) - $this->getLength()); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | foreach (new Combinations($items, $this->getLength()) as $dataset) { |
| 46 | 46 | if (empty($dataset)) { |
| 47 | 47 | $return = array($perms); |
| 48 | - } else { |
|
| 48 | + } else { |
|
| 49 | 49 | $return = array(); |
| 50 | 50 | $datasetCount = count($dataset) - 1; |
| 51 | 51 | for ($i = $datasetCount; $i >= 0; --$i) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function toArray() { |
| 69 | 69 | $results = array(); |
| 70 | 70 | |
| 71 | - foreach($this->generator() as $value) { |
|
| 71 | + foreach ($this->generator() as $value) { |
|
| 72 | 72 | $results[] = $value; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function current() { |
| 49 | 49 | $r = array(); |
| 50 | - for($i = 0; $i < $this->length; $i++) { |
|
| 50 | + for ($i = 0; $i < $this->length; $i++) { |
|
| 51 | 51 | $r[] = $this->dataset[$this->c[$i]]; |
| 52 | 52 | } |
| 53 | 53 | return $r; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | while ($i >= 0 && $this->c[$i] == $this->datasetCount - $this->length + $i) { |
| 89 | 89 | $i--; |
| 90 | 90 | } |
| 91 | - if($i < 0) { |
|
| 91 | + if ($i < 0) { |
|
| 92 | 92 | return FALSE; |
| 93 | 93 | } |
| 94 | 94 | $this->c[$i]++; |
| 95 | - while($i++ < $this->length - 1) { |
|
| 95 | + while ($i++ < $this->length - 1) { |
|
| 96 | 96 | $this->c[$i] = $this->c[$i - 1] + 1; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function toArray() { |
| 106 | 106 | $data = []; |
| 107 | - for($this->rewind(); $this->valid(); $this->next()) { |
|
| 107 | + for ($this->rewind(); $this->valid(); $this->next()) { |
|
| 108 | 108 | $data[] = $this->current(); |
| 109 | 109 | } |
| 110 | 110 | return $data; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return int |
| 115 | 115 | */ |
| 116 | 116 | public function count() { |
| 117 | - return $this->fact(count($this->getDataset()))/$this->fact($this->getLength()); |
|
| 117 | + return $this->fact(count($this->getDataset())) / $this->fact($this->getLength()); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | } |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | public function next() { |
| 60 | 60 | if ($this->_next()) { |
| 61 | 61 | $this->pos++; |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | $this->pos = -1; |
| 65 | 64 | } |
| 66 | 65 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | * @return int |
| 76 | 76 | */ |
| 77 | 77 | protected function fact($n, $total = 1) { |
| 78 | - return ($n < 2) ? $total : $this->fact($n-1, $total * $n); |
|
| 78 | + return ($n < 2) ? $total : $this->fact($n - 1, $total * $n); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | \ No newline at end of file |