Passed
Push — main ( b436ac...f1b4ad )
by N.
04:39
created

Oddssummor::oddssummor()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 12
nc 3
nop 0
dl 0
loc 18
ccs 13
cts 13
cp 1
crap 3
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Oddssummor.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\DistributionGenerera;
11
12
/**
13
 * Klass Oddssummor.
14
 */
15
class Oddssummor extends Spara {
16
	/**
17
	 * Beräkna oddssummor för aktuella sannolikheter.
18
	 * @return float[]
19
	 */
20 1
	protected function oddssummor(): array {
21 1
		$oddssumma_utfall = 0.0;
22 1
		$oddssumma_min = 0.0;
23 1
		$oddssumma_max = 0.0;
24
25 1
		foreach ($this->tips->odds->sannolikheter as $k => $odds) {
26 1
			if ($this->tips->utdelning->tipsrad_012) {
27 1
				$oddssumma_utfall += $odds[$this->tips->utdelning->tipsrad_012[$k]];
28
			}
29
30 1
			$oddssumma_min += ne_min($odds);
31 1
			$oddssumma_max += ne_max($odds);
32
		}
33
34 1
		return [
35 1
			round($oddssumma_min, 2),
36 1
			round($oddssumma_max, 2),
37 1
			round($oddssumma_utfall, 2)
38 1
		];
39
	}
40
}
41