@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param $config Configuration |
| 176 | 176 | * |
| 177 | 177 | */ |
| 178 | - public static function getCountsFromTest($pdo, $config, $tests){ |
|
| 178 | + public static function getCountsFromTest($pdo, $config, $tests) { |
|
| 179 | 179 | $resp = []; |
| 180 | 180 | foreach ($tests as $test) { |
| 181 | 181 | $counts = self::getCountsById($pdo, $config, $test[0]); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * @param $config Configuration |
| 190 | 190 | * |
| 191 | 191 | */ |
| 192 | - public static function getFromByTest($pdo, $config, $tests){ |
|
| 192 | + public static function getFromByTest($pdo, $config, $tests) { |
|
| 193 | 193 | $resp = []; |
| 194 | 194 | foreach ($tests as $test) { |
| 195 | 195 | $counts = FromDAO::findByFromById($pdo, $config, $test[1][1], $test[1][0]); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param $config Configuration |
| 275 | 275 | * |
| 276 | 276 | */ |
| 277 | - public static function findIdByTimeUser($pdo, $config, $by=[]) { |
|
| 277 | + public static function findIdByTimeUser($pdo, $config, $by = []) { |
|
| 278 | 278 | return OptionsDAO::findIdByTimeUser($pdo, $config, $by); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -179,7 +179,9 @@ |
||
| 179 | 179 | $resp = []; |
| 180 | 180 | foreach ($tests as $test) { |
| 181 | 181 | $counts = self::getCountsById($pdo, $config, $test[0]); |
| 182 | - if (count($counts) > 0) $resp[] = $counts; |
|
| 182 | + if (count($counts) > 0) { |
|
| 183 | + $resp[] = $counts; |
|
| 184 | + } |
|
| 183 | 185 | } |
| 184 | 186 | return $resp; |
| 185 | 187 | } |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $dbFromtable = $config->getFromTableName(); |
| 77 | 77 | $qdata = [$id]; |
| 78 | 78 | $tquery = "SELECT f.* FROM $dbFromtable f WHERE f.id = ?"; |
| 79 | - if ($from_id != null) { |
|
| 79 | + if ($from_id!=null) { |
|
| 80 | 80 | $tquery = $tquery." AND f.from_id = ?"; |
| 81 | 81 | $qdata[] = $from_id; |
| 82 | 82 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public static function getPDO($config, $options) |
| 84 | 84 | { |
| 85 | - if (array_key_exists("pdo",$options)) { |
|
| 85 | + if (array_key_exists("pdo", $options)) { |
|
| 86 | 86 | return $options["pdo"]; |
| 87 | 87 | } |
| 88 | 88 | return Persistence::getPDO($config); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $result = $data; |
| 188 | - for ($i=1;$i<$level;$i++) { |
|
| 188 | + for ($i = 1; $i < $level; $i++) { |
|
| 189 | 189 | $tmp = Matrix::multiply($result, $data); |
| 190 | 190 | $result = Matrix::sum($result, $tmp); |
| 191 | 191 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $result = $data; |
| 221 | - for ($i=1;$i<$level;$i++) { |
|
| 221 | + for ($i = 1; $i < $level; $i++) { |
|
| 222 | 222 | $tmp = Matrix::multiply($result, $data); |
| 223 | 223 | $result = Matrix::sum($result, $tmp); |
| 224 | 224 | } |
@@ -179,8 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | if (array_key_exists("level", $options)) { |
| 181 | 181 | $level = $options["level"]; |
| 182 | - } |
|
| 183 | - else { |
|
| 182 | + } else { |
|
| 184 | 183 | $level = count($labels) - 1; |
| 185 | 184 | } |
| 186 | 185 | |
@@ -212,8 +211,7 @@ discard block |
||
| 212 | 211 | |
| 213 | 212 | if (array_key_exists("level", $options)) { |
| 214 | 213 | $level = $options["level"]; |
| 215 | - } |
|
| 216 | - else { |
|
| 214 | + } else { |
|
| 217 | 215 | $level = count($labels) - 1; |
| 218 | 216 | } |
| 219 | 217 | |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | public static function ABtest($testCounts, $targetCounts, $options) |
| 27 | 27 | { |
| 28 | 28 | $ntotal = 0; |
| 29 | - $resp = []; |
|
| 30 | - foreach($testCounts as $testCount) { |
|
| 29 | + $resp = []; |
|
| 30 | + foreach ($testCounts as $testCount) { |
|
| 31 | 31 | $ntotal += $testCount[1]; |
| 32 | 32 | } |
| 33 | - foreach($testCounts as $testCount) { |
|
| 33 | + foreach ($testCounts as $testCount) { |
|
| 34 | 34 | foreach ($targetCounts as $targetCount) { |
| 35 | - if ($testCount[0] === $targetCount[1]) { |
|
| 36 | - $resp[] = [$testCount[0], $testCount[1], $testCount[1]/$ntotal, $targetCount[2], $targetCount[2]/$testCount[1],$targetCount[2]/$ntotal]; |
|
| 35 | + if ($testCount[0]===$targetCount[1]) { |
|
| 36 | + $resp[] = [$testCount[0], $testCount[1], $testCount[1] / $ntotal, $targetCount[2], $targetCount[2] / $testCount[1], $targetCount[2] / $ntotal]; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |