Passed
Push — main ( 9152fd...203f91 )
by N.
03:37
created

Preferenser::uppdatera_preferenser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 18
ccs 16
cts 16
cp 1
crap 1
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Preferenser.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\HG;
11
12
use Tips\Klasser\Utdelning;
13
use Tips\Klasser\Prediktioner;
14
use Tips\Klasser\Matcher;
15
use Tips\Klasser\DBPreferenser;
16
use Tips\Egenskaper\Tick;
17
use Tips\Moduler\HG\Konstanter;
18
19
/**
20
 * Klass Preferenser.
21
 */
22
class Preferenser {
23
	use Tick;
24
	use Konstanter;
25
26
	public DBPreferenser $db_preferenser;
27
	public int $hg_min = self::HG_MIN;
28
	/**
29
	 * @var string[] $utdata
30
	 */
31
	public array $utdata = [];
32
33 3
	public function __construct(
34
		protected Utdelning $utdelning,
35
		protected Prediktioner $odds,
36
		protected Prediktioner $streck,
37
		protected Matcher $matcher
38
	) {
39 3
	}
40
41
	/**
42
	 * Uppdatera preferenser.
43
	 */
44 3
	protected function uppdatera_preferenser(): void {
45 3
		$this->db_preferenser->int_preferens_i_intervall(
46 3
			$this->attraktionsfaktor,
47 3
			AF_MIN,
48 3
			AF_MAX,
49 3
			AF_STD,
50 3
			'hg.attraktionsfaktor'
51 3
		);
52
53 3
		$this->db_preferenser->int_preferens_i_intervall(
54 3
			$this->hg_min,
55 3
			self::HG_MIN,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\HG\Preferenser::HG_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
56 3
			self::HG_MAX,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\HG\Preferenser::HG_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
57 3
			self::HG_STD,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\HG\Preferenser::HG_STD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
58 3
			'hg.hg_min'
59 3
		);
60
61 3
		$this->db_preferenser->hämta_preferens('hg.hg_min');
62
	}
63
}
64