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

Tick::tick()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Egenskap Tick.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Egenskaper;
11
12
/**
13
 * Egenskap Tick.
14
 */
15
trait Tick {
16
	protected int $tick = 0;
17
	protected int $attraktionsfaktor = AF_STD;
0 ignored issues
show
Bug introduced by
The constant Tips\Egenskaper\AF_STD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
18
19
	/**
20
	 * Statisk räknare.
21
	 */
22
	protected function tick(): bool {
23
		$this->tick = ($this->tick + 1) % $this->attraktionsfaktor;
24
		return $this->tick === 0;
25
	}
26
27
	/**
28
	 * Visa faktor för nyttjandefrekvens av modul.
29
	 */
30
	protected function attraktionsfaktor(int $attraktionsfaktor, string $id): string {
31
		return '| <span class="pekare" id="' . $id . '_min">🔻</span> <input class="nummer" type="number" min="1" max="1594323" autocomplete="off" id="' .
32
			$id . '" value="' . $attraktionsfaktor . '"> <span class="pekare" id="' . $id . '_max">🔺</span> ';
33
	}
34
}
35