Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  * @see \BitWasp\Buffertools\Types\TypeInterface::write()
  * @param Parser $parser
  * @return \BitWasp\Buffertools\Buffer
  * @throws \BitWasp\Buffertools\Exceptions\ParserOutOfRange
  * @throws \Exception
  */
 public function read(Parser &$parser)
 {
     $length = $this->varint->read($parser);
     if ($this->varint->getMath()->cmp($length, 0) == 0) {
         return new Buffer();
     }
     return $parser->readBytes($length);
 }