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

Tick   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 18
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A tick() 0 3 1
A attraktionsfaktor() 0 3 1
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