Passed
Push — main ( a92fbe...d29be2 )
by N.
05:41 queued 01:24
created

Intervall::preferens_i_intervall()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 5
dl 0
loc 4
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Intervall class.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Klasser\DBPreferenser;
11
12
/**
13
 * Intervall class.
14
 */
15
class Intervall extends InOut {
16
	/**
17
	 * Is preference in a given interval?
18
	 */
19 2
	public function preferens_i_intervall(float &$tal, float $min, float $max, float $grund, string $pref): void {
20 2
		$oreferens = $this->hämta_preferens($pref);
21 2
		$tal = (float) $oreferens;
22 2
		in($tal, $min, $max) or $this->spara_preferens($pref, strval($grund));
23
	}
24
25
	/**
26
	 * Is preference in a given integer interval?
27
	 */
28 4
	public function int_preferens_i_intervall(int &$tal, int $min, int $max, int $grund, string $pref): void {
29 4
		$oreferens = $this->hämta_preferens($pref);
30 4
		$tal = (int) $oreferens;
31 4
		in($tal, $min, $max) or $this->spara_preferens($pref, strval($grund));
32
	}
33
}
34