Passed
Push — main ( 2cd955...f234a7 )
by Anatolyi
21:01 queued 10:54
created

SeedPair   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 18
c 1
b 0
f 1
dl 0
loc 50
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getNonce() 0 3 1
A getServerSeed() 0 3 1
A increment() 0 7 1
A getNextServerSeed() 0 3 1
A __construct() 0 10 1
A getClientSeed() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gambling\Tech\Game;
6
7
class SeedPair
8
{
9
    private string $serverSeed;
10
11
    private string $nextServerSeed;
12
13
    private string $clientSeed;
14
15
    private int $nonce;
16
17
    public function __construct(
18
        string $serverSeed,
19
        string $nextServerSeed,
20
        string $clientSeed,
21
        int $nonce
22
    ) {
23
        $this->serverSeed = $serverSeed;
24
        $this->nextServerSeed = $nextServerSeed;
25
        $this->clientSeed = $clientSeed;
26
        $this->nonce = $nonce;
27
    }
28
29
    public static function increment(self $seedPair): self
30
    {
31
        return new self(
32
            $seedPair->getServerSeed(),
33
            $seedPair->getNextServerSeed(),
34
            $seedPair->getClientSeed(),
35
            $seedPair->getNonce() + 1
36
        );
37
    }
38
39
    public function getServerSeed(): string
40
    {
41
        return $this->serverSeed;
42
    }
43
44
    public function getNextServerSeed(): string
45
    {
46
        return $this->nextServerSeed;
47
    }
48
49
    public function getClientSeed(): string
50
    {
51
        return $this->clientSeed;
52
    }
53
54
    public function getNonce(): int
55
    {
56
        return $this->nonce;
57
    }
58
}
59