Passed
Push — main ( f1b4ad...6ccac6 )
by N.
04:46
created

RenderaOmgang::rendera_html()   A

Complexity

Conditions 4
Paths 1

Size

Total Lines 25
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 9
nc 1
nop 5
dl 0
loc 25
ccs 9
cts 9
cp 1
crap 4
rs 9.9666
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * Klass RenderaOmgang.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Klasser\Omgang;
11
12
use Tips\Klasser\Tips;
13
use Tips\Egenskaper\Eka;
14
15
/**
16
 * Klass RenderaOmgang.
17
 */
18
final class RenderaOmgang {
19
	use Eka;
20
21
	/**
22
	 * Init.
23
	 */
24 1
	public function __construct(private Tips $tips) {
25 1
	}
26
27
	/**
28
	 * Eka ut resultatet i HTML.
29
	 */
30 1
	public function rendera_html(
31
		string $grid_omgång,
32
		string $föregående,
33
		string $nästa,
34
		int $antal_kompletta,
35
		int $antal_omgångar
36
	): string {
37
		/**
38
		 * Eka ut resultatet i HTML.
39
		 */
40 1
		return <<< EOT
41 1
						<a href="/"><div class="logotyp {$this->tips->spel->speltyp->produktnamn()}">
42
							<img src="/img/ss.svg" height="30" class="ss-logo" alt="Svenska spel">
43 1
							<img src="/img/{$this->tips->spel->speltyp->produktnamn()}.svg" height="45" alt="{$this->tips->spel->speltyp->produktnamn()}">
44
						</div></a>
45
						<form id="manuell">
46 1
							<span style="font-size: 2em; vertical-align: middle;">{$this->eka($this->tips->spel->komplett ? '✅' : '❌')}</span>
47
							<select id="genererad_omgång">
48 1
$grid_omgång							</select>
49
							<input type="text" autocomplete="off" id="manuell_omgång" size="6" value="">
50
							<input type="submit" value="Manuell"><br>
51
						</form>
52 1
						<button{$this->eka($föregående ? '' : ' disabled="disabled"')} id="föregående" value="$föregående">⇦</button>
53 1
						<button{$this->eka($nästa ? '' : ' disabled="disabled"')} id="nästa" value="$nästa">⇨</button>
54 1
						($antal_kompletta / $antal_omgångar)
55 1
EOT;
56
	}
57
}
58