ProvaRad::pröva_rad()   A
last analyzed

Complexity

Conditions 5
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 10.3999

Importance

Changes 0
Metric Value
cc 5
eloc 8
nc 2
nop 1
dl 0
loc 14
ccs 4
cts 10
cp 0.4
crap 10.3999
rs 9.6111
c 0
b 0
f 0
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