Lines
100.00%
3 / 3
Functions and Methods
100.00%
3 / 3
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| InMemoryVersions | 100.00% | 3 / 3 | 100.00% | 3 / 3 | 3 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| current | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| learn | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Client\Session; | |
| 6 | ||
| 7 | use Override; | |
| 8 | ||
| 9 | final class InMemoryVersions implements Versions | |
| 10 | { | |
| 11 | private ClientVersion $current; | |
| 12 | ||
| 13 | public function __construct(?ClientVersion $current = null) | |
| 14 | { | |
| 15 | $this->current = $current ?? new ClientVersion(Login::VERSION); | |
| 16 | } | |
| 17 | ||
| 18 | #[Override] | |
| 19 | public function current(): ClientVersion | |
| 20 | { | |
| 21 | return $this->current; | |
| 22 | } | |
| 23 | ||
| 24 | #[Override] | |
| 25 | public function learn(ClientVersion $version): void | |
| 26 | { | |
| 27 | $this->current = $version; | |
| 28 | } | |
| 29 | } |