| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 16 | 3 | public function decodeProtocolHeader(string $data, int $offset = 0): ProtocolHeader |
|
| 17 | { |
||
| 18 | 3 | if ((\strlen($data) - $offset) < ProtocolHeader::WIRE_SIZE) { |
|
| 19 | 1 | throw new InsufficientDataException( |
|
| 20 | 1 | "Protocol header requires " . ProtocolHeader::WIRE_SIZE |
|
| 21 | 1 | . " bytes, got " . (\strlen($data) - $offset) . " bytes" |
|
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | 2 | return new ProtocolHeader(\unpack('Preserved/vtype/vreserved', $data, $offset)['type']); |
|
| 26 | } |
||
| 28 |