| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 2 | public function getEncodedMapPath(int $mapFieldType, LayerInterface $layer): string |
|
| 21 | { |
||
| 22 | 2 | $key = $this->stuConfig->getGameSettings()->getMapSettings()->getEncryptionKey(); |
|
| 23 | 2 | if ($key === null) { |
|
| 24 | 1 | throw new RuntimeException('encoding key is missing in configuration'); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | $cipher = base64_encode(crypt((string)$mapFieldType, $key)); |
|
| 28 | 1 | $cipher = str_replace('/', '5', $cipher); |
|
| 29 | |||
| 30 | 1 | return sprintf( |
|
| 31 | 1 | '%d/encoded/%s.png', |
|
| 32 | 1 | $layer->getId(), |
|
| 33 | 1 | implode("/", str_split($cipher, 8)) |
|
|
|
|||
| 34 | 1 | ); |
|
| 37 |