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

Prova::annonsera()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 1
rs 10
c 0
b 0
f 0
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