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

Andel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 4
dl 0
loc 8
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Andel.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler;
11
12
use ReflectionClass;
13
use Tips\Klasser\Utdelning;
14
use Tips\Klasser\Prediktioner;
15
use Tips\Klasser\Matcher;
16
use Tips\Moduler\Andel\Andelar;
17
18
/**
19
 * Klass Andel.
20
 * Filtrerar givna teckenandelar i intervall.
21
 */
22
final class Andel extends Andelar {
23
	/**
24
	 * Initiera. Uppdatera konstruktor.
25
	 */
26 1
	public function __construct(
27
		protected Utdelning $utdelning,
28
		protected Prediktioner $odds,
29
		protected Prediktioner $streck,
30
		protected Matcher $matcher
31
	) {
32 1
		parent::__construct($utdelning, $odds, $streck, $matcher);
33 1
		$this->uppdatera_preferenser();
34
	}
35
36
	/**
37
	 * Visa modul.
38
	 */
39
	public function visa_modul(): void {
40
		$klass = (new ReflectionClass($this))->getShortName();
41
		echo <<< EOT
42
			<div id="modulflikar-$klass">
43
				<p>1: 3–8 | X: 1–6 | 2: 2–7 (86%)</p>
44
				<div>
45
					<p>1: <input type="number" size="2" min=0 max=13 autocomplete="off" id="andel_1_min" value="{$this->andel_1_min}">–
46
					<input type="number" size="2" min=0 max=13 autocomplete="off" id="andel_1_max" value="{$this->andel_1_max}"> |
47
					X: <input type="number" size="2" min=0 max=13 autocomplete="off" id="andel_x_min" value="{$this->andel_x_min}">–
48
					<input type="number" size="2" min=0 max=13 autocomplete="off" id="andel_x_max" value="{$this->andel_x_max}"> |
49
					2: <input type="number" size="2" min=0 max=13 autocomplete="off" id="andel_2_min" value="{$this->andel_2_min}">–
50
					<input type="number" size="2" min=0 max=13 autocomplete="off" id="andel_2_max" value="{$this->andel_2_max}"></p>
51
				</div>
52
				<div class="andel-kolumner">
53
{$this->andelar()}				</div>
54
			</div> <!-- modulflikar-$klass -->
55
56
EOT;
57
	}
58
}
59