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

TTGridMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 41
ccs 16
cts 16
cp 1
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 1
	public function __construct(public TT $tt) {
22 1
	}
23
24
	/**
25
	 * Grid för TT-matcher.
26
	 */
27 1
	public function tt_grid_matcher(): string {
28 1
		$matchtabeller = (new Matchtabeller($this->tt))->matchtabeller();
29
30
		/**
31
		 * Bygg tabellhuvud för spikar.
32
		 */
33 1
		$th_rad = '';
34 1
		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 1
			$th_rad .= <<< EOT
36 1
									<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 1
EOT;
39
		}
40
41 1
		$scheman = new TTGridScheman();
42 1
		return <<< EOT
43 1
						<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 1
$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 1
{$matchtabeller[0]}							</table>
55
						</div>
56 1
{$scheman->tt_grid_scheman()}
57 1
{$this->matchdataform($matchtabeller[1])}
58
59 1
EOT;
60
	}
61
}
62