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

Prova   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A pröva_tipsrad() 0 3 2
A annonsera() 0 9 1
A kommentar() 0 2 1
1
<?php
2
3
/**
4
 * Klass AutProvaospik.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\Autospik;
11
12
use Tips\Egenskaper\Tick;
13
14
/**
15
 * Klass Prova.
16
 */
17
class Prova extends Spikar {
18
	use Tick;
19
20
	/**
21
	 * Pröva tipsrad.
22
	 */
23 3
	public function pröva_tipsrad(string $tipsrad_012): bool {
24 3
		$this->teckenindex = array_map(fn (int $spik): int => (int) $tipsrad_012[$spik], $this->spikar);
25 3
		return $this->teckenindex === $this->oddsindex || $this->tick();
26
	}
27
28
	/**
29
	 * Annonsera modul.
30
	 */
31 3
	public function annonsera(): string {
32 3
		$generator = <<< EOT
33
34
							<select id="autospik_ext">
35 3
{$this->generatorsträng(8)}							</select>
36 3
EOT;
37 3
		$spikar = array_map(fn (int $spik): int => $spik + 1, $this->spikar);
38 3
		return "{$this->valda_spikar} (" . implode(', ', $spikar) . ') ' .
39 3
			$this->attraktionsfaktor($this->attraktionsfaktor, 'autospik_attraktionsfaktor') . $generator;
40
	}
41
42
	/**
43
	 * Visa kommentar.
44
	 */
45 1
	public function kommentar(): string {
46 1
		return self::class . " {$this->valda_spikar} | a={$this->attraktionsfaktor}";
47
	}
48
}
49