Passed
Push — master ( 5e8c3b...31fead )
by Ruben
02:18
created
src/Configuration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
      */
198 198
     private static function getStringParameter($config, $section, $name)
199 199
     {    
200
-        return isset($config[$section][$name]) ?  $config[$section][$name] : NULL;
200
+        return isset($config[$section][$name]) ? $config[$section][$name] : NULL;
201 201
     }
202 202
     
203 203
     /*
Please login to merge, or discard this patch.
src/Persistence.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@
 block discarded – undo
244 244
      * @param $config Configuration
245 245
      *
246 246
      */
247
-    public static function findIdByTimeUser($pdo, $config, $by=[]) {
247
+    public static function findIdByTimeUser($pdo, $config, $by = []) {
248 248
         return OptionsDAO::findIdByTimeUser($pdo, $config, $by);
249 249
     }
250 250
     
Please login to merge, or discard this patch.
src/Matrix.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@
 block discarded – undo
91 91
         }
92 92
         for ($i=0; $i<$n1; $i++) {
93 93
             for ($j=0; $j<$m2; $j++) {
94
-                 for ($k=0; $k<$n2; $k++) {
95
-                     $result[$i][$j] += $matrix1[$i][$k]*$matrix2[$k][$j];
96
-                 }
94
+                    for ($k=0; $k<$n2; $k++) {
95
+                        $result[$i][$j] += $matrix1[$i][$k]*$matrix2[$k][$j];
96
+                    }
97 97
             }
98 98
         }        
99 99
         return $result;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
     public static function submatrix($matrix, $columns)
25 25
     {
26 26
         $n = count($matrix);
27
-        if ($n == 0) return [];
27
+        if ($n==0) return [];
28 28
        
29 29
         $m = count($matrix[0]);
30
-        if ($m == 0) return $matrix;
30
+        if ($m==0) return $matrix;
31 31
        
32 32
         $result = [];       
33
-        for ($i=0; $i<$n; $i++) {
33
+        for ($i = 0; $i < $n; $i++) {
34 34
             $tmp = [];
35 35
             foreach ($columns as $col) {
36 36
                 $tmp[] = $matrix[$i][$col];
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
     public static function toSquareMatrix($matrix, $ncol, mcol, $val, $sparse = False)
48 48
     {
49 49
         $n = count($matrix);
50
-        if ($n == 0) return [];
50
+        if ($n==0) return [];
51 51
         
52 52
         $labels = {};
53 53
         $id = 0;
54 54
         $data = [];
55
-        for ($i=0; $i<$n; $i++) {              
55
+        for ($i = 0; $i < $n; $i++) {              
56 56
             $nid = $labels[$matrix[$i][$ncol]];                
57 57
             $mid = $labels[$matrix[$i][$mcol]];
58 58
             $val = $matrix[$i][$val];
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
         
63 63
         $nlab = count($labels);
64 64
         $result = [];
65
-        for ($i=0; $i<$nlab; $i++) {           
65
+        for ($i = 0; $i < $nlab; $i++) {           
66 66
             $tmp = array_fill(0, $nlab, 0);
67 67
             $result[] = $tmp;
68 68
         }
69
-        for ($i=0; $i<$n; $i++) {           
69
+        for ($i = 0; $i < $n; $i++) {           
70 70
             $result[$data[0]][$data[1]] = $data[2];
71 71
         }
72 72
         return ["data" => $result, "labels" => $labels];
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
         $n2 = count($matrix2);        
84 84
         $m2 = count($matrix2[0]);
85 85
         
86
-        if ($n2 !== $m1) throw new Exception("Incompatible matrices: matrix1.columns != matrix2.rows");
86
+        if ($n2!==$m1) throw new Exception("Incompatible matrices: matrix1.columns != matrix2.rows");
87 87
 
88 88
         $result = [];
89
-        for ($i=0; $i<$n1; $i++) {           
89
+        for ($i = 0; $i < $n1; $i++) {           
90 90
             $result[] = array_fill(0, $m2, 0);                    
91 91
         }
92
-        for ($i=0; $i<$n1; $i++) {
93
-            for ($j=0; $j<$m2; $j++) {
94
-                 for ($k=0; $k<$n2; $k++) {
95
-                     $result[$i][$j] += $matrix1[$i][$k]*$matrix2[$k][$j];
92
+        for ($i = 0; $i < $n1; $i++) {
93
+            for ($j = 0; $j < $m2; $j++) {
94
+                 for ($k = 0; $k < $n2; $k++) {
95
+                     $result[$i][$j] += $matrix1[$i][$k] * $matrix2[$k][$j];
96 96
                  }
97 97
             }
98 98
         }        
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public static function power($matrix, $n)
106 106
     {
107
-        if($n <= 1) return $matrix;        
107
+        if ($n <= 1) return $matrix;        
108 108
         $resp = multiply($matrix, $matrix);
109
-        if($n == 2) return $resp;
110
-        for($i=2; $i<$n; $i++) {
109
+        if ($n==2) return $resp;
110
+        for ($i = 2; $i < $n; $i++) {
111 111
             $resp = multiply($resp, $matrix);
112 112
         }
113 113
         return $resp;
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,10 +24,14 @@  discard block
 block discarded – undo
24 24
     public static function submatrix($matrix, $columns)
25 25
     {
26 26
         $n = count($matrix);
27
-        if ($n == 0) return [];
27
+        if ($n == 0) {
28
+            return [];
29
+        }
28 30
        
29 31
         $m = count($matrix[0]);
30
-        if ($m == 0) return $matrix;
32
+        if ($m == 0) {
33
+            return $matrix;
34
+        }
31 35
        
32 36
         $result = [];       
33 37
         for ($i=0; $i<$n; $i++) {
@@ -47,7 +51,9 @@  discard block
 block discarded – undo
47 51
     public static function toSquareMatrix($matrix, $ncol, mcol, $val, $sparse = False)
48 52
     {
49 53
         $n = count($matrix);
50
-        if ($n == 0) return [];
54
+        if ($n == 0) {
55
+            return [];
56
+        }
51 57
         
52 58
         $labels = {};
53 59
         $id = 0;
@@ -58,7 +64,9 @@  discard block
 block discarded – undo
58 64
             $val = $matrix[$i][$val];
59 65
             $data[] = [$nid, $mid, $val];
60 66
         }
61
-        if ($sparse) return ["data" => $data, "labels" => $labels];
67
+        if ($sparse) {
68
+            return ["data" => $data, "labels" => $labels];
69
+        }
62 70
         
63 71
         $nlab = count($labels);
64 72
         $result = [];
@@ -83,7 +91,9 @@  discard block
 block discarded – undo
83 91
         $n2 = count($matrix2);        
84 92
         $m2 = count($matrix2[0]);
85 93
         
86
-        if ($n2 !== $m1) throw new Exception("Incompatible matrices: matrix1.columns != matrix2.rows");
94
+        if ($n2 !== $m1) {
95
+            throw new Exception("Incompatible matrices: matrix1.columns != matrix2.rows");
96
+        }
87 97
 
88 98
         $result = [];
89 99
         for ($i=0; $i<$n1; $i++) {           
@@ -104,9 +114,13 @@  discard block
 block discarded – undo
104 114
      */
105 115
     public static function power($matrix, $n)
106 116
     {
107
-        if($n <= 1) return $matrix;        
117
+        if($n <= 1) {
118
+            return $matrix;
119
+        }
108 120
         $resp = multiply($matrix, $matrix);
109
-        if($n == 2) return $resp;
121
+        if($n == 2) {
122
+            return $resp;
123
+        }
110 124
         for($i=2; $i<$n; $i++) {
111 125
             $resp = multiply($resp, $matrix);
112 126
         }
Please login to merge, or discard this patch.