Passed
Push — main ( e5ef3a...f1ef56 )
by N.
04:15
created

Visa   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 36
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A visa_genererade_rader() 0 30 4
1
<?php
2
3
/**
4
 * Klass Visa.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Klasser\Spelade;
11
12
/**
13
 * Klass Visa.
14
 */
15
class Visa extends Mall {
16
	public bool $spelad = false;
17
18
	/**
19
	 * Visa genererade rader.
20
	 */
21 1
	public function visa_genererade_rader(): void {
22 1
		if (file_exists(GRAF . $this->bildfil)) {
23 1
			$this->tipsgraf = $this->graf->rendera_tipsgraf($this->bildfil);
24
		}
25
26 1
		$radknapp = '';
27 1
		$kombinationsgraf = '';
28
29
		/**
30
		 * Spel finns för omgången.
31
		 */
32 1
		if ($this->spelad) {
33
			/**
34
			 * Lägg rader som sträng i request.
35
			 */
36 1
			$kod = base64_encode("{$this->mappnamn}/{$this->utdelning->spel->filnamn}.txt");
37
38 1
			$radknapp = t(7, "<p><a id=\"radknapp\" target=\"_blank\" href=\"/ajax/RaderAjax.php?fil=$kod\">{$this->antal_utvalda_rader} r ↗️</a></p>");
39
40
			/**
41
			 * Återskapa tipsrader i filsystemet.
42
			 */
43 1
			if (!file_exists($this->textfil)) {
44 1
				$this->spara_genererade_tipsrader_fil();
45
			}
46
47 1
			$kombinationsgraf = $this->kombinationsgraf('/kombinationsgraf.png', $this->bildfil);
48
		}
49
50 1
		$this->markup($radknapp, $kombinationsgraf);
51
	}
52
}
53