Passed
Push — main ( a92fbe...d29be2 )
by N.
05:41 queued 01:24
created

Tipsrader::hämta_tipsrader()   A

Complexity

Conditions 5
Paths 6

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
cc 5
eloc 8
nc 6
nop 0
dl 0
loc 13
ccs 0
cts 9
cp 0
crap 30
rs 9.6111
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Tipsrader.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\Vinstgraf;
11
12
/**
13
 * Klass Tipsrader.
14
 */
15
class Tipsrader extends Rita {
16
	public int $antal_rader = 0;
17
	public int $totalt_antal_rader = 0;
18
	/** @var array<int, array{string, int}> $tipsrader */ protected array $tipsrader = [];
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<int, array{string, int}> at position 6 could not be parsed: Expected ':' at position 6, but found 'string'.
Loading history...
19
20
	/**
21
	 * Hämta tipsrader.
22
	 */
23
	protected function hämta_tipsrader(): void {
24
		$u13 = $this->utdelning->utdelningsdata();
25
26
		foreach ($this->odds->tipsdata() as $omgång => $tipsrad_012) {
27
			if (isset($u13[$omgång])) {
28
				$this->totalt_antal_rader++;
29
30
				if ($u13[$omgång] === 0) {
31
					$u13[$omgång] = MAXVINST;
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\Vinstgraf\MAXVINST was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
32
				}
33
34
				if (in($u13[$omgång], $this->utdelning_13_min, $this->utdelning_13_max)) {
35
					$this->tipsrader[] = [$tipsrad_012, $u13[$omgång]];
36
				}
37
			}
38
		}
39
	}
40
}
41