Пример #1
0
 function testSizeVarint()
 {
     foreach ($this->tests as $i => $enc) {
         if (is_string($i)) {
             $i = (double) $i;
         }
         $len = Protobuf::size_varint($i);
         $this->assertSame(strlen($enc), $len, "Incorrect size_varint({$i})");
     }
 }
Пример #2
0
 public function size()
 {
     $size = 0;
     if (!is_null($this->logGroupList_)) {
         foreach ($this->logGroupList_ as $v) {
             $l = $v->size();
             $size += 1 + Protobuf::size_varint($l) + $l;
         }
     }
     return $size;
 }
Пример #3
0
 public function size()
 {
     $size = 0;
     if (!is_null($this->logs_)) {
         foreach ($this->logs_ as $v) {
             $l = $v->size();
             $size += 1 + Protobuf::size_varint($l) + $l;
         }
     }
     if (!is_null($this->reserved_)) {
         $l = strlen($this->reserved_);
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->topic_)) {
         $l = strlen($this->topic_);
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->source_)) {
         $l = strlen($this->source_);
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     return $size;
 }
Пример #4
0
function size_tests()
{
    run("size_varint", function () {
        for ($i = 0; $i < LOOPS; $i++) {
            Protobuf::size_varint(mt_rand());
        }
    });
}
 public function size()
 {
     $size = 0;
     if (!is_null($this->context_)) {
         $l = $this->context_->size();
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->appsResponse_)) {
         $l = $this->appsResponse_->size();
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->commentsResponse_)) {
         $l = $this->commentsResponse_->size();
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->imageResponse_)) {
         $l = $this->imageResponse_->size();
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->categoriesResponse_)) {
         $l = $this->categoriesResponse_->size();
         $size += 2 + Protobuf::size_varint($l) + $l;
     }
     if (!is_null($this->subCategoriesResponse_)) {
         $l = $this->subCategoriesResponse_->size();
         $size += 1 + Protobuf::size_varint($l) + $l;
     }
     return $size;
 }