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

TTGridBokforing   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 39
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A tt_grid_bokföring() 0 24 1
1
<?php
2
3
/**
4
 * Klass TTGridBokforing.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\TT;
11
12
use Tips\Moduler\TT;
13
use Tips\Egenskaper\Eka;
14
use Tips\Egenskaper\Ajax;
15
16
/**
17
 * Klass TTGridBokforing.
18
 * Bokför och visa datum, omgång, insats, antal rätt samt vinst.
19
 * Enbart momentan omgång, stöd för arkiv saknas.
20
 * @SuppressWarnings("PHPMD.UnusedPrivateMethod")
21
 */
22
final class TTGridBokforing extends HamtaBokforing {
23
	use Eka;
24
	use Ajax;
0 ignored issues
show
Bug introduced by
The trait Tips\Egenskaper\Ajax requires the property $logg which is not provided by Tips\Moduler\TT\TTGridBokforing.
Loading history...
25
26
	/**
27
	 * Initiera.
28
	 */
29 1
	public function __construct(private TT $tt) {
30 1
		parent::__construct($tt);
31 1
		$this->förgrena();
32
	}
33
34
	/**
35
	 * Bokföring av topptipsspel.
36
	 */
37 1
	public function tt_grid_bokföring(): string {
38 1
		$datum = date("Y-m-d H:i");
39 1
		$tabelldata = $this->tt_hämta_bokföring();
40 1
		return <<< EOT
41 1
						<table id="tt_bokföringstabell" class="omgångstabell">
42 1
							<caption>Senast spelade | Visa antal: <input id="tt_visa_antal_bokföringar" class="nummer_litet" type="number" value="{$this->tt->visa_antal_bokf}"></caption>
43
							<tr class="match">
44
								<th>#</th>
45
								<th>Datum</th>
46
								<th>Omgång</th>
47
								<th>Insats</th>
48
								<th>Rätt</th>
49
								<th colspan="2">Vinst</th>
50
							</tr>
51 1
$tabelldata
52
						</table>
53
						<form method="post" action="/#modulflikar-TT">
54
							<table>
55
								<tr class="odds">
56
									<td><input type="hidden" name="tt_spara_bokföring">Ny</td>
57 1
									<td><input type="text" name="datum" value="$datum"></td>
58 1
									<td><input type="text" size="5" name="omgång" value="{$this->tt->omgång}"></td>
59 1
									<td><input type="text" size="5" name="insats" value="{$this->tt->antal_rader}"></td>
60 1
									<td><button type="submit">Bokför {$this->tt->omgång}</button></td>
61
								</tr>
62
							</table>
63
						</form>
64 1
EOT;
65
	}
66
}
67