Passed
Push — main ( e5ef3a...f1ef56 )
by N.
04:15
created

Kod::tt_rkod()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass Kod.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\Ajax\TTAjax;
11
12
use Tips\Moduler\TT\TTKod;
13
use Tips\Moduler\TT\TTRKod;
14
15
/**
16
 * Klass Kod.
17
 */
18
class Kod extends Rader {
19
	/**
20
	 * Spara aktuell kod för Topptipset.
21
	 */
22 1
	protected function tt_kod(): void {
23 1
		$kod = TTKod::tryFrom((string) filter_var($_REQUEST['tt_kod'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\Ajax\TTAjax...TIZE_FULL_SPECIAL_CHARS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
24 1
		if (!($kod instanceof TTKod)) {
25 1
			$kod = TTKod::cases()[0];
26
		}
27
28 1
		$this->db_preferenser->spara_preferens('topptips.kod', $kod->value);
29 1
		echo <<< EOT
30 1
{$kod->koddata()}
31 1
EOT;
32
	}
33
34
	/**
35
	 * Spara aktuell R-kod för Topptipset.
36
	 */
37 1
	protected function tt_rkod(): void {
38 1
		$rkod = TTRKod::tryFrom((string) filter_var($_REQUEST['tt_rkod'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\Ajax\TTAjax...TIZE_FULL_SPECIAL_CHARS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
39 1
		if (!($rkod instanceof TTRKod)) {
40 1
			$rkod = TTRKod::cases()[0];
41
		}
42
43 1
		$this->db_preferenser->spara_preferens('topptips.rkod', $rkod->value);
44 1
		echo <<< EOT
45 1
{$rkod->koddata()}
46 1
EOT;
47
	}
48
}
49