| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 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 |
||
| 57 | } |
||
| 58 | } |
||
| 59 |