Passed
Push — main ( 40d4d0...b1f2dd )
by N.
05:04
created

Prova   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 30
ccs 0
cts 12
cp 0
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
	public function pröva_tipsrad(string $tipsrad_012): bool {
24
		$this->teckenindex = array_map(fn (int $spik): int => (int) $tipsrad_012[$spik], $this->spikar);
25
		return $this->teckenindex === $this->oddsindex || $this->tick();
26
	}
27
28
	/**
29
	 * Annonsera modul.
30
	 */
31
	public function annonsera(): string {
32
		$generator = <<< EOT
33
34
							<select id="autospik_ext">
35
{$this->generatorsträng(8)}							</select>
36
EOT;
37
		$spikar = array_map(fn (int $spik): int => $spik + 1, $this->spikar);
38
		return "{$this->valda_spikar} (" . implode(', ', $spikar) . ') ' .
39
			$this->attraktionsfaktor($this->attraktionsfaktor, 'autospik_attraktionsfaktor') . $generator;
40
	}
41
42
	/**
43
	 * Visa kommentar.
44
	 */
45
	public function kommentar(): string {
46
		return self::class . " {$this->valda_spikar} | a={$this->attraktionsfaktor}";
47
	}
48
}
49