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

ProvaRad::pröva_intervall()   A

Complexity

Conditions 6
Paths 18

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 6

Importance

Changes 0
Metric Value
cc 6
eloc 5
nc 18
nop 1
dl 0
loc 6
ccs 6
cts 6
cp 1
crap 6
rs 9.2222
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 1
			foreach (array_keys($this->tt->spikar) as $index) {
26 1
				$ok and $ok = $this->pröva_spikar(
27 1
					$this->tt->spikar[$index],
28 1
					$this->tt->andel_spikar[$index],
29 1
					$tipsrad_012
30 1
				);
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 1
	private function pröva_intervall(string $tipsrad_012): bool {
52 1
		$ok = true;
53 1
		$this->tt->tt_pröva_täckning and $ok = $this->pröva_täckningskod($tipsrad_012);
54 1
		$ok and $this->tt->tt_pröva_t_intv and $ok = $this->pröva_teckenintervall($tipsrad_012);
55 1
		$ok and $this->tt->tt_pröva_o_intv and $ok = $this->pröva_oddsintervall($tipsrad_012);
56 1
		return $ok;
57
	}
58
}
59