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

KlusterAjax::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Klass KlusterAjax.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\Ajax;
11
12
use Tips\Klasser\Preludium;
13
use Tips\Klasser\Spel;
14
use Tips\Klasser\Tips;
15
use Tips\Moduler\Kluster;
16
use Tips\Egenskaper\Ajax;
17
use Tips\Moduler\Kluster\Konstanter;
18
19
/**
20
 * Ajaxanrop ligger utanför ordinarie ordning.
21
 */
22 1
require_once dirname(__FILE__) . '/../../../vendor/autoload.php';
23 1
new Preludium();
24
25
/**
26
 * Klass KlusterAjax.
27
 * @SuppressWarnings("PHPMD.UnusedPrivateMethod")
28
 */
29
final class KlusterAjax {
30
	use Ajax;
0 ignored issues
show
Bug introduced by
The trait Tips\Egenskaper\Ajax requires the property $logg which is not provided by Tips\Moduler\Ajax\KlusterAjax.
Loading history...
31
	use Konstanter;
32
33 2
	public function __construct() {
34 2
		$this->förgrena();
35
	}
36
37
	/**
38
	 * Håll min antal per kluster inom godtagbara intervall.
39
	 */
40 1
	private function min_antal(): void {
0 ignored issues
show
Unused Code introduced by
The method min_antal() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
41 1
		$this->db_preferenser->validera_indata('min_antal', self::KLUSTER_MIN_ANTAL_MIN, self::KLUSTER_MIN_ANTAL_MAX, self::KLUSTER_MIN_ANTAL_STD, 'kluster.min_antal');
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\Ajax\Kluste...::KLUSTER_MIN_ANTAL_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant Tips\Moduler\Ajax\Kluste...::KLUSTER_MIN_ANTAL_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant Tips\Moduler\Ajax\Kluste...::KLUSTER_MIN_ANTAL_STD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42 1
		$this->uppdatera_graf();
43
	}
44
45
	/**
46
	 * Håll minimumradie inom godtagbara intervall.
47
	 */
48 1
	private function min_radie(): void {
0 ignored issues
show
Unused Code introduced by
The method min_radie() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
49 1
		$this->db_preferenser->validera_indata('min_radie', self::KLUSTER_MIN_RADIE_MIN, self::KLUSTER_MIN_RADIE_MAX, self::KLUSTER_MIN_RADIE_STD, 'kluster.min_radie');
0 ignored issues
show
Bug introduced by
The constant Tips\Moduler\Ajax\Kluste...::KLUSTER_MIN_RADIE_STD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant Tips\Moduler\Ajax\Kluste...::KLUSTER_MIN_RADIE_MIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The constant Tips\Moduler\Ajax\Kluste...::KLUSTER_MIN_RADIE_MAX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
50 1
		$this->uppdatera_graf();
51
	}
52
53
	/**
54
	 * Uppdatera graf.
55
	 */
56 2
	private function uppdatera_graf(): void {
57 2
		$spel = new Spel();
58 2
		$tips = new Tips($spel);
59 2
		$kluster = new Kluster($tips->utdelning, $tips->odds, $tips->streck, $tips->matcher);
60 2
		$kluster->finn_kluster();
61 2
		$tips->moduler->skapa_kombinationsgraf();
62
	}
63
64
	/**
65
	 * Spara attraktionsfaktor.
66
	 */
67 1
	private function attraktionsfaktor(): void {
0 ignored issues
show
Unused Code introduced by
The method attraktionsfaktor() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
68 1
		$this->ändra_attraktionsfaktor('kluster');
69
	}
70
}
71
72
new KlusterAjax();
73