Passed
Push — main ( 40d4d0...b1f2dd )
by N.
05:04
created

GridResultatModuler::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 5
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass GridResultatModuler.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Klasser\Omgang;
11
12
use Tips\Klasser\Tips;
13
14
/**
15
 * Klass GridResultatModuler.
16
 */
17
class GridResultatModuler {
18
	protected Tips $tips;
19
	/** @var int[] $rättvektor */ protected array $rättvektor = [];
20
	protected int $antal_rader = 0;
21
	protected int $vinst = 0;
22
	protected bool $spelad = false;
23
24 1
	public function __construct(Tips $tips) {
25 1
		$this->tips = $tips;
26 1
		$this->rättvektor = array_fill(0, MATCHANTAL + 1, 0);
0 ignored issues
show
Bug introduced by
The constant Tips\Klasser\Omgang\MATCHANTAL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
27 1
		$this->antal_rader = count($this->tips->spelade->tipsvektor);
28 1
		$this->spelad = ($this->tips->utdelning->har_tipsrad && $this->antal_rader > 0);
29
	}
30
31
	/**
32
	 * Visa resultat för enskilda moduler.
33
	 */
34 1
	protected function moduler(): string {
35 1
		$modulsträng = '';
36 1
		foreach ($this->tips->moduler->moduldata as $modul => [$ok, $annons]) {
37
			$modulsträng .= t(7, "$ok $modul $annons<br>");
0 ignored issues
show
Bug introduced by
The function t was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
			$modulsträng .= /** @scrutinizer ignore-call */ t(7, "$ok $modul $annons<br>");
Loading history...
38
		}
39 1
		return $modulsträng;
40
	}
41
}
42