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

SeedPair::getNextServerSeed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
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