Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
50 | 14 | public function read(Parser $parser): BufferInterface |
|
51 | { |
||
52 | 14 | $length = $this->varint->read($parser); |
|
53 | |||
54 | 14 | if ($length > $parser->getSize() - $parser->getPosition()) { |
|
55 | 2 | throw new ParserOutOfRange("Insufficient data remaining for VarString"); |
|
56 | } |
||
57 | |||
58 | 12 | if (gmp_cmp(gmp_init($length, 10), gmp_init(0, 10)) == 0) { |
|
59 | 2 | return new Buffer(); |
|
60 | } |
||
61 | |||
62 | 10 | return $parser->readBytes((int) $length); |
|
63 | } |
||
64 | } |
||
65 |