Passed
Push — main ( e5e48e...78d8c3 )
by N.
05:08
created

Tipsdata   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 16
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A tipsdata() 0 11 2
1
<?php
2
3
/**
4
 * Klass Tipsdata.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Klasser\Prediktioner;
11
12
use PDO;
13
14
/**
15
 * Klass Tipsdata.
16
 */
17
class Tipsdata extends Prediktionsdata {
18
	/**
19
	 * Hämta tipsdata för alla omgångar.
20
	 * @return array<string, string>
21
	 */
22 1
	public function tipsdata(int $u13_min = 0, int $u13_max = MAXVINST): array {
23 1
		$tipsdata = [];
24 1
		$sats = $this->spel->db->instans->prepare("SELECT `omgång`, `tipsrad_012` FROM `utdelning`
25 1
			WHERE `tipsrad_012` AND `u13` BETWEEN :u13_min AND :u13_max ORDER BY `omgång`");
26 1
		$sats->bindValue(':u13_min', $u13_min, PDO::PARAM_INT);
27 1
		$sats->bindValue(':u13_max', $u13_max, PDO::PARAM_INT);
28 1
		$sats->execute();
29 1
		foreach ($sats->fetchAll(PDO::FETCH_ASSOC) as $r) {
30 1
			$tipsdata[(string) $r['omgång']] = $r['tipsrad_012'];
31
		}
32 1
		return $tipsdata;
33
	}
34
}
35