public function testChecksEof() { $handle = fopen('php://temp', 'w+'); $stream = new Stream($handle); fwrite($handle, 'data'); $this->assertFalse($stream->eof()); $stream->read(4); $this->assertTrue($stream->eof()); }
/** * Decode a 64bit double. * * @param \Protobuf\Stream $stream * * @return float */ public function readDouble(Stream $stream) { $bytes = $stream->read(8); if ($this->isBigEndian) { $bytes = strrev($bytes); } list(, $result) = unpack('d', $bytes); return $result; }