read($len); $data = ''; $got = 0; while (($got = strlen($data)) < $len) { $data .= $this->read($len - $got); } return $data; } /** * Writes the given data out. * * @param string $buf The data to write * @throws TTransportException if writing fails */ public abstract function write(string $buf): void; /** * Flushes any pending data out of a buffer * * @throws TTransportException if a writing error occurs */ public function flush(): void {} /** * Flushes any pending data out of a buffer for a oneway call * * @throws TTransportException if a writing error occurs */ public function onewayFlush(): void { // Default to flush() $this->flush(); } }