| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public static function decode(string $bytes, array $data): array |
||
| 24 | { |
||
| 25 | $deserializer = new Deserializer($bytes); |
||
| 26 | $result = []; |
||
| 27 | $index = 0; |
||
| 28 | foreach ($data as $value) { |
||
| 29 | $format = $value['format'] ?? null; |
||
| 30 | if (empty($format)) { |
||
| 31 | continue; |
||
| 32 | } |
||
| 33 | $bigEndian = $value['big_endian'] ?? false; |
||
| 34 | $result[$index] = match ($format) { |
||
| 35 | Formats::LONG => $deserializer->readLong($bigEndian), |
||
| 36 | Formats::LONG_LONG => $deserializer->readLongLong($bigEndian), |
||
| 37 | Formats::STRING => $deserializer->readString() |
||
| 38 | }; |
||
| 39 | $index++; |
||
| 40 | } |
||
| 41 | return $result; |
||
| 42 | } |
||
| 68 | } |