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

GridResultatModuler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A moduler() 0 6 2
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