|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Klass Spara. |
|
5
|
|
|
* @author Niklas Dougherty |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
declare(strict_types=1); |
|
9
|
|
|
|
|
10
|
|
|
namespace Tips\Moduler\DistributionGenerera; |
|
11
|
|
|
|
|
12
|
|
|
use PDO; |
|
13
|
|
|
use Tips\Klasser\Tips; |
|
14
|
|
|
use Tips\Moduler\Distribution; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Klass Spara. |
|
18
|
|
|
*/ |
|
19
|
|
|
class Spara { |
|
20
|
|
|
/** |
|
21
|
|
|
* @var bool[] $andel_vid |
|
22
|
|
|
*/ |
|
23
|
|
|
protected array $andel_vid; |
|
24
|
|
|
|
|
25
|
1 |
|
public function __construct(protected Tips $tips, protected Distribution $dist) { |
|
26
|
1 |
|
$this->andel_vid = array_fill_keys(['10', '5', '3', '2', '1', '0.5'], false); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Spara distribution. |
|
31
|
|
|
*/ |
|
32
|
1 |
|
protected function spara_distribution(): void { |
|
33
|
1 |
|
$sats = $this->tips->odds->spel->db->instans->prepare("REPLACE INTO `distribution` |
|
34
|
|
|
(`omgång`, `speltyp`, `sekvens`, `minsumma`, `maxsumma`, `minprocent`, `maxprocent`, |
|
35
|
|
|
`oddssumma`, `procentandel`, `andelssumma`) VALUES |
|
36
|
|
|
(:omgang, :speltyp, :sekvens, :minsumma, :maxsumma, :minprocent, :maxprocent, |
|
37
|
1 |
|
:oddssumma, :procentandel, :andelssumma)"); |
|
38
|
1 |
|
$sats->bindValue(':omgang', $this->tips->odds->spel->omgång, PDO::PARAM_INT); |
|
39
|
1 |
|
$sats->bindValue(':speltyp', $this->tips->odds->spel->speltyp->value, PDO::PARAM_INT); |
|
40
|
1 |
|
$sats->bindValue(':sekvens', $this->tips->odds->spel->sekvens, PDO::PARAM_INT); |
|
41
|
1 |
|
$sats->bindValue(':minsumma', $this->dist->minsumma, PDO::PARAM_STR); |
|
42
|
1 |
|
$sats->bindValue(':maxsumma', $this->dist->maxsumma, PDO::PARAM_STR); |
|
43
|
1 |
|
$sats->bindValue(':minprocent', $this->dist->minprocent, PDO::PARAM_STR); |
|
44
|
1 |
|
$sats->bindValue(':maxprocent', $this->dist->maxprocent, PDO::PARAM_STR); |
|
45
|
1 |
|
$sats->bindValue(':oddssumma', $this->dist->oddssumma, PDO::PARAM_STR); |
|
46
|
1 |
|
$sats->bindValue(':procentandel', $this->dist->procentandel, PDO::PARAM_STR); |
|
47
|
1 |
|
$sats->bindValue(':andelssumma', $this->dist->andelssumma, PDO::PARAM_INT); |
|
48
|
1 |
|
$sats->execute(); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|