MessagePack\BufferUnpacker::append PHP Method

append() public method

public append ( string $data )
$data string
    public function append($data)
    {
        $this->buffer .= $data;
        return $this;
    }

Usage Example

 public function testTryUnpackTruncatesBuffer()
 {
     $this->unpacker->append("�");
     $this->assertSame([true], $this->unpacker->tryUnpack());
     try {
         $this->unpacker->unpack();
     } catch (InsufficientDataException $e) {
         $this->assertSame('Not enough data to unpack: expected 1, got 0.', $e->getMessage());
         return;
     }
     $this->fail('Buffer was not truncated.');
 }