Passed
Push — main ( 7b37bf...2735bf )
by N.
03:10
created

Autospik::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 4
dl 0
loc 9
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Autospik.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler;
11
12
use ReflectionClass;
13
use Tips\Klasser\Tips;
14
use Tips\Klasser\Utdelning;
15
use Tips\Klasser\Prediktioner;
16
use Tips\Klasser\Matcher;
17
use Tips\Egenskaper\Eka;
18
use Tips\Moduler\Autospik\Prova;
19
20
/**
21
 * Klass Autospik.
22
 */
23
final class Autospik extends Prova {
24
	use Eka;
25
26
	public string $tipsrader = '';
27
	public int $spikar_rätt = 0;
28
	/**
29
	 * @var string[] $tipsvektor
30
	 */
31
	public array $tipsvektor = [];
32
33
	public function __construct(
34
		protected Utdelning $utdelning,
35
		protected Prediktioner $odds,
36
		protected Prediktioner $streck,
37
		protected Matcher $matcher
38
	) {
39
		parent::__construct($utdelning, $odds, $streck, $matcher);
40
		$this->uppdatera_preferenser();
41
		$this->beräkna_spikar();
42
	}
43
44
	/**
45
	 * Visa modul.
46
	 */
47
	public function visa_modul(): void {
48
		$klass = (new ReflectionClass($this))->getShortName();
49
50
		echo <<< EOT
51
			<div id="modulflikar-$klass">
52
				<div class="autospik-grid">
53
					<div class="autospik-grid-garderingar">
54
						<h1>{$this->eka($this->utdelning->har_tipsrad && $this->pröva_tipsrad($this->utdelning->tipsrad_012) ? '✅' : '❌')} $klass</h1>
55
{$this->grid_garderingar()}
56
					</div> <!-- autospik-grid-garderingar -->
57
					<div class="autospik-grid-historik">
58
$this->historik					</div> <!-- autospik-grid-historik -->
59
				</div> <!-- autospik-grid -->
60
			</div> <!-- modulflikar-$klass -->
61
62
EOT;
63
	}
64
65
	/**
66
	 * Spara omgång.
67
	 * @SuppressWarnings("PHPMD.UnusedFormalParameter")
68
	 */
69
	public function spara_omgång(Tips $tips): void {
0 ignored issues
show
Unused Code introduced by
The parameter $tips is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

69
	public function spara_omgång(/** @scrutinizer ignore-unused */ Tips $tips): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
70
		$this->autospik_historik();
71
		$this->odds->spel->db->logg->logga(self::class . ': ✅ Sparade historik.');
72
	}
73
}
74