Conditions | 3 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 2 | public function load(string $playerName): Player |
|
28 | { |
||
29 | 2 | if (!file_exists($fileName = $this->resolvePlayerSaveFile($playerName))) { |
|
30 | 1 | throw PlayerStateException::notFound($fileName); |
|
31 | } |
||
32 | |||
33 | 1 | assert(is_readable($fileName)); |
|
34 | 1 | $playerNormalized = json_decode(file_get_contents($fileName) ?: '', true); |
|
35 | |||
36 | 1 | return ($this->denormalizePlayer)($playerNormalized); |
|
37 | } |
||
46 |