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

GridResultatModuler::moduler()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
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 0
dl 0
loc 6
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);
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 1
			$modulsträng .= t(7, "$ok $modul $annons<br>");
38
		}
39 1
		return $modulsträng;
40
	}
41
}
42