ProvaRad   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 40
ccs 9
cts 21
cp 0.4286
rs 10
c 0
b 0
f 0
wmc 14

3 Methods

Rating   Name   Duplication   Size   Complexity  
A reduktion_intervall() 0 6 3
A pröva_intervall() 0 6 6
A pröva_rad() 0 14 5
1
<?php
2
3
/**
4
 * Klass ProvaRad.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\TT\TTGridGenerera;
11
12
use Tips\Moduler\TT;
13
14
/**
15
 * Klass ProvaRad.
16
 */
17
class ProvaRad extends Prova {
18
	/**
19
	 * Pröva TT-rad.
20
	 */
21 1
	protected function pröva_rad(string $tipsrad_012): bool {
22 1
		$ok = $this->reduktion_intervall($tipsrad_012);
23
24 1
		if ($ok && $this->tt->tt_pröva_spikar) {
25
			foreach (array_keys($this->tt->spikar) as $index) {
26
				$ok and $ok = $this->pröva_spikar(
27
					$this->tt->spikar[$index],
28
					$this->tt->andel_spikar[$index],
29
					$tipsrad_012
30
				);
31
			}
32
		}
33
34 1
		return $ok;
35
	}
36
37
	/**
38
	 * Pröva reduktion och intervall, delberäkning.
39
	 */
40 1
	private function reduktion_intervall(string $tipsrad_012): bool {
41 1
		$ok = true;
42
43 1
		$this->tt->tt_pröva_reduktion and $ok = $this->pröva_reduktion($tipsrad_012);
44 1
		$ok and $ok = $this->pröva_intervall($tipsrad_012);
45 1
		return $ok;
46
	}
47
48
	/**
49
	 * Pröva intervall, delberäkning.
50
	 */
51
	private function pröva_intervall(string $tipsrad_012): bool {
52
		$ok = true;
53
		$this->tt->tt_pröva_täckning and $ok = $this->pröva_täckningskod($tipsrad_012);
54
		$ok and $this->tt->tt_pröva_t_intv and $ok = $this->pröva_teckenintervall($tipsrad_012);
55
		$ok and $this->tt->tt_pröva_o_intv and $ok = $this->pröva_oddsintervall($tipsrad_012);
56
		return $ok;
57
	}
58
}
59