Passed
Push — main ( f1b4ad...6ccac6 )
by N.
04:46
created

Oddssummor::oddssummor()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 12
nc 3
nop 0
dl 0
loc 18
ccs 0
cts 13
cp 0
crap 12
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
	protected function oddssummor(): array {
21
		$oddssumma_utfall = 0.0;
22
		$oddssumma_min = 0.0;
23
		$oddssumma_max = 0.0;
24
25
		foreach ($this->tips->odds->sannolikheter as $k => $odds) {
26
			if ($this->tips->utdelning->tipsrad_012) {
27
				$oddssumma_utfall += $odds[$this->tips->utdelning->tipsrad_012[$k]];
28
			}
29
30
			$oddssumma_min += ne_min($odds);
31
			$oddssumma_max += ne_max($odds);
32
		}
33
34
		return [
35
			round($oddssumma_min, 2),
36
			round($oddssumma_max, 2),
37
			round($oddssumma_utfall, 2)
38
		];
39
	}
40
}
41