Completed
Push — master ( 7f834d...3d4931 )
by Pol
02:09
created
src/Permutations.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Combinations.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
src/Combinatorics.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.