protected function _read($num) { $buffer = ByteBuffer::create(); $count = 0; while ($count < $num) { $byte = fgetc($socket); $buffer->push($byte); } return $buffer; }
/** * testBufferFixedValue function. * * @access public * @return void * @group websocket * @group websocket_buffer */ public function testBufferFixedValue() { $arr = array(0, 1, 56, 128, 37, 40, 72, 148); $buffer = ByteBuffer::create($arr); $this->assertEquals(343598007077012, $buffer->sum()); }
public function getBuffer() { if ($this->buffer) { return $this->buffer; } else { return $this->buffer = ByteBuffer::create(array()); } }