Passed
Push — main ( 203f91...e5e48e )
by N.
03:27
created

TTGridMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 41
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 1 1
A tt_grid_matcher() 0 31 2
1
<?php
2
3
/**
4
 * Klass TTGridMatcher.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\TT;
11
12
use Tips\Moduler\TT;
13
14
/**
15
 * Klass TTGridMatcher.
16
 */
17
final class TTGridMatcher extends Matchdataform {
18
	/**
19
	 * Initiera.
20
	 */
21
	public function __construct(public TT $tt) {
22
	}
23
24
	/**
25
	 * Grid för TT-matcher.
26
	 */
27
	public function tt_grid_matcher(): string {
28
		$matchtabeller = (new Matchtabeller($this->tt))->matchtabeller();
29
30
		/**
31
		 * Bygg tabellhuvud för spikar.
32
		 */
33
		$th_rad = '';
34
		for ($j = 0; $j < $this->tt::TT_MAX_SPIKFÄLT; $j++) {
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\TT::TT_MAX_SPIKFÄLT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
35
			$th_rad .= <<< EOT
36
									<th colspan="3" class="match"><input tabindex="-1" style="width: 3em;" type="number" min="0" max="13" step="1" name="tt_andel_spikar[$j]" value="{$this->tt->andel_spikar[$j]}">/{$this->tt->antal_spikar[$j]}</th>
37
38
EOT;
39
		}
40
41
		$scheman = new TTGridScheman();
42
		return <<< EOT
43
						<div>
44
							<table id="topptipstabell" class="topptipstabell">
45
								<tr>
46
									<th class="match">#</th>
47
									<th class="match">Match</th>
48
									<th class="match">E</th>
49
$th_rad									<th colspan="3"><span id="tt_antal_helgarderingar"></span> H | h <span id="tt_antal_halvgarderingar"></span></th>
50
									<th class="match">🡄</th>
51
									<th class="match">🞭</th>
52
									<th class="match">🔻</th>
53
								</tr>
54
{$matchtabeller[0]}							</table>
55
						</div>
56
{$scheman->tt_grid_scheman()}
57
{$this->matchdataform($matchtabeller[1])}
58
59
EOT;
60
	}
61
}
62