function testWriteVarint() { foreach ($this->tests as $i => $enc) { if (is_string($i)) { // Skip floats without exact reprentation, they will make the test // fail, and there is nothing we can do about it. if (!hasExactRepresentation($i)) { continue; } $i = (double) $i; } $this->reset(); $len = Protobuf::write_varint($this->fp, $i); $this->assertBinaryEqual($enc, $this->get(), "Failed to write_varint({$i})"); } }
function write($fp) { if (!$this->validateRequired()) { throw new Exception('Required fields are missing'); } if (!is_null($this->logGroupList_)) { foreach ($this->logGroupList_ as $v) { fwrite($fp, "\n"); Protobuf::write_varint($fp, $v->size()); // message $v->write($fp); } } }
function write($fp) { if (!$this->validateRequired()) { throw new Exception('Required fields are missing'); } if (!is_null($this->logs_)) { foreach ($this->logs_ as $v) { fwrite($fp, "\n"); Protobuf::write_varint($fp, $v->size()); // message $v->write($fp); } } if (!is_null($this->reserved_)) { fwrite($fp, ""); Protobuf::write_varint($fp, strlen($this->reserved_)); fwrite($fp, $this->reserved_); } if (!is_null($this->topic_)) { fwrite($fp, ""); Protobuf::write_varint($fp, strlen($this->topic_)); fwrite($fp, $this->topic_); } if (!is_null($this->source_)) { fwrite($fp, "\""); Protobuf::write_varint($fp, strlen($this->source_)); fwrite($fp, $this->source_); } }
function write($fp) { if (!$this->validateRequired()) { throw new Exception('Required fields are missing'); } if (!is_null($this->context_)) { fwrite($fp, ""); Protobuf::write_varint($fp, $this->context_->size()); // message $this->context_->write($fp); } if (!is_null($this->appsResponse_)) { fwrite($fp, ""); Protobuf::write_varint($fp, $this->appsResponse_->size()); // message $this->appsResponse_->write($fp); } if (!is_null($this->commentsResponse_)) { fwrite($fp, "\""); Protobuf::write_varint($fp, $this->commentsResponse_->size()); // message $this->commentsResponse_->write($fp); } if (!is_null($this->imageResponse_)) { fwrite($fp, "R"); Protobuf::write_varint($fp, $this->imageResponse_->size()); // message $this->imageResponse_->write($fp); } if (!is_null($this->categoriesResponse_)) { fwrite($fp, "¢"); Protobuf::write_varint($fp, $this->categoriesResponse_->size()); // message $this->categoriesResponse_->write($fp); } if (!is_null($this->subCategoriesResponse_)) { fwrite($fp, "j"); Protobuf::write_varint($fp, $this->subCategoriesResponse_->size()); // message $this->subCategoriesResponse_->write($fp); } }