Passed
Push — master ( ed30c1...df214b )
by Ruben
02:19
created
src/ML.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
         $niter = 0;
32 32
         $maxiter = 100;
33 33
         $npoints = count($data);
34
-        if ($npoints <= 0) throw new \Exception("Not enough data. ");    
34
+        if ($npoints <= 0) {
35
+            throw new \Exception("Not enough data. ");
36
+        }
35 37
         $ndimensions = count($data[0]);
36 38
         $centroids = self::select_disjoint($data, $nclusters);
37 39
         
@@ -102,7 +104,9 @@  discard block
 block discarded – undo
102 104
     private static function contains_point($matrix, $array) 
103 105
     {
104 106
         foreach ($matrix as $row){
105
-            if (self::isEqual($row, $array)) return true;
107
+            if (self::isEqual($row, $array)) {
108
+                return true;
109
+            }
106 110
         }
107 111
         return false;
108 112
     }
@@ -113,9 +117,13 @@  discard block
 block discarded – undo
113 117
     private static function isEqual($array1, $array2)
114 118
     {
115 119
         $len = count($array1);
116
-        if($len != count($array2) ) return false;
120
+        if($len != count($array2) ) {
121
+            return false;
122
+        }
117 123
         for ($i=0; $i<$len; $i++) {
118
-            if ($array1[$i] != $array2[$i]) return false;
124
+            if ($array1[$i] != $array2[$i]) {
125
+                return false;
126
+            }
119 127
         }
120 128
         return true;
121 129
     }
Please login to merge, or discard this patch.