Preferenser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 110
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 65
dl 0
loc 110
ccs 65
cts 65
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A uppdatera_preferenser() 0 86 1
1
<?php
2
3
/**
4
 * Klass Preferenser.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\TT;
11
12
use Tips\Moduler\TT\Konstanter;
13
use Tips\Moduler\TT\TTKod;
14
use Tips\Moduler\TT\TTRKod;
15
16
/**
17
 * Klass Preferenser.
18
 * Kontrollera inställningar.
19
 */
20
class Preferenser extends Koder {
21
	use Konstanter;
22
23
	public bool $tt_pröva_spikar;
24
	public bool $tt_pröva_täckning;
25
	public bool $tt_pröva_t_intv;
26
	public bool $tt_pröva_o_intv;
27
	public bool $tt_pröva_reduktion;
28
29
	public int $odds_rätt_min = self::TT_ODDS_RÄTT_MIN;
30
	public int $odds_rätt_max = self::TT_ODDS_RÄTT_MAX;
31
	public int $antal_1_min = self::TT_ANTAL_1_MIN;
32
	public int $antal_1_max = self::TT_ANTAL_1_MAX;
33
	public int $antal_X_min = self::TT_ANTAL_X_MIN;
34
	public int $antal_X_max = self::TT_ANTAL_X_MAX;
35
	public int $antal_2_min = self::TT_ANTAL_2_MIN;
36
	public int $antal_2_max = self::TT_ANTAL_2_MAX;
37
38
	public int $visa_antal_bokf = 5;
39
	public string $strategi = '';
40
41
	/**
42
	 * Uppdatera preferenser.
43
	 */
44 20
	protected function uppdatera_preferenser(): void {
45 20
		$this-> hämta_koder();
46
47
		/**
48
		 * Min odds rätt inom intervall.
49
		 */
50 20
		$this->db_preferenser->int_preferens_i_intervall(
51 20
			$this->odds_rätt_min,
52 20
			0,
53 20
			self::TT_MATCHANTAL,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_MATCHANTAL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
54 20
			self::TT_ODDS_RÄTT_MIN,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ODDS_RÄTT_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
55 20
			'topptips.odds_rätt_min'
56 20
		);
57
58
		/**
59
		 * Max odds rätt inom intervall.
60
		 */
61 20
		$this->db_preferenser->int_preferens_i_intervall(
62 20
			$this->odds_rätt_max,
63 20
			0,
64 20
			self::TT_MATCHANTAL,
65 20
			self::TT_ODDS_RÄTT_MAX,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ODDS_RÄTT_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
66 20
			'topptips.odds_rätt_max'
67 20
		);
68
69
		/**
70
		 * Antal tecken inom intervall.
71
		 */
72 20
		$this->db_preferenser->int_preferens_i_intervall(
73 20
			$this->antal_1_min,
74 20
			0,
75 20
			self::TT_MATCHANTAL,
76 20
			self::TT_ANTAL_1_MIN,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ANTAL_1_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
77 20
			'topptips.antal_1_min'
78 20
		);
79
80 20
		$this->db_preferenser->int_preferens_i_intervall(
81 20
			$this->antal_1_max,
82 20
			0,
83 20
			self::TT_MATCHANTAL,
84 20
			self::TT_ANTAL_1_MAX,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ANTAL_1_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
85 20
			'topptips.antal_1_max'
86 20
		);
87
88 20
		$this->db_preferenser->int_preferens_i_intervall(
89 20
			$this->antal_X_min,
90 20
			0,
91 20
			self::TT_MATCHANTAL,
92 20
			self::TT_ANTAL_X_MIN,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ANTAL_X_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
93 20
			'topptips.antal_X_min'
94 20
		);
95
96 20
		$this->db_preferenser->int_preferens_i_intervall(
97 20
			$this->antal_X_max,
98 20
			0,
99 20
			self::TT_MATCHANTAL,
100 20
			self::TT_ANTAL_X_MAX,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ANTAL_X_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
101 20
			'topptips.antal_X_max'
102 20
		);
103
104 20
		$this->db_preferenser->int_preferens_i_intervall(
105 20
			$this->antal_2_min,
106 20
			0,
107 20
			self::TT_MATCHANTAL,
108 20
			self::TT_ANTAL_2_MIN,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ANTAL_2_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
109 20
			'topptips.antal_2_min'
110 20
		);
111
112 20
		$this->db_preferenser->int_preferens_i_intervall(
113 20
			$this->antal_2_max,
114 20
			0,
115 20
			self::TT_MATCHANTAL,
116 20
			self::TT_ANTAL_2_MAX,
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT\Preferenser::TT_ANTAL_2_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
117 20
			'topptips.antal_2_max'
118 20
		);
119
120
		/**
121
		 * Hämta inställningar.
122
		 */
123 20
		$this->tt_pröva_spikar = (bool) $this->db_preferenser->hämta_preferens('topptips.tt_pröva_spikar');
124 20
		$this->tt_pröva_täckning = (bool) $this->db_preferenser->hämta_preferens('topptips.tt_pröva_täckning');
125 20
		$this->tt_pröva_reduktion = (bool) $this->db_preferenser->hämta_preferens('topptips.tt_pröva_reduktion');
126 20
		$this->tt_pröva_t_intv = (bool) $this->db_preferenser->hämta_preferens('topptips.tt_pröva_t_intv');
127 20
		$this->tt_pröva_o_intv = (bool) $this->db_preferenser->hämta_preferens('topptips.tt_pröva_o_intv');
128 20
		$this->strategi = $this->db_preferenser->hämta_preferens('topptips.strategi');
129 20
		$this->visa_antal_bokf = (int) $this->db_preferenser->hämta_preferens('topptips.visa_antal_bokf');
130
	}
131
}
132