| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 1 | public function prediktionsdata(string $tabell, int $u13_min = 0, int $u13_max = MAXVINST): array { |
|
| 23 | 1 | $prediktionsdata = []; |
|
| 24 | 1 | $pred = implode(', ', array_map(fn (int $i): string => "`p$i`", PLATT_ODDSMATRIS)); // `p1`, `p2`, …, `p39` |
|
| 25 | 1 | $sats = $this->spel->db->instans->prepare("SELECT $pred, `omgång` FROM `$tabell` NATURAL JOIN `utdelning` |
|
| 26 | 1 | WHERE `$tabell`.`komplett` AND `tipsrad_012` AND `u13` BETWEEN :u13_min AND :u13_max ORDER BY `omgång`"); |
|
| 27 | 1 | $sats->bindValue(':u13_min', $u13_min, PDO::PARAM_INT); |
|
| 28 | 1 | $sats->bindValue(':u13_max', $u13_max, PDO::PARAM_INT); |
|
| 29 | 1 | $sats->execute(); |
|
| 30 | 1 | foreach ($sats->fetchAll(PDO::FETCH_ASSOC) as $rad) { |
|
| 31 | 1 | $prediktionsdata[(string) $rad['omgång']] = |
|
| 32 | 1 | array_chunk(array_map(fn (int $n): float => $rad["p$n"], PLATT_ODDSMATRIS), 3); |
|
| 33 | } |
||
| 34 | 1 | return $prediktionsdata; |
|
| 35 | } |
||
| 37 |