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