Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
channelstats.php
1<?
2
4
15class ChannelStats extends \Protobuf\AbstractMessage
16{
17
21 protected $unknownFieldSet = null;
22
26 protected $extensions = null;
27
33 protected $id = null;
34
40 protected $isPrivate = null;
41
47 protected $isOnline = null;
48
54 public function hasId()
55 {
56 return $this->id !== null;
57 }
58
64 public function getId()
65 {
66 return $this->id;
67 }
68
74 public function setId($value = null)
75 {
76 if ($value !== null && ! $value instanceof \Protobuf\Stream) {
77 $value = \Protobuf\Stream::wrap($value);
78 }
79
80 $this->id = $value;
81 }
82
88 public function hasIsPrivate()
89 {
90 return $this->isPrivate !== null;
91 }
92
98 public function getIsPrivate()
99 {
100 return $this->isPrivate;
101 }
102
108 public function setIsPrivate($value = null)
109 {
110 $this->isPrivate = $value;
111 }
112
118 public function hasIsOnline()
119 {
120 return $this->isOnline !== null;
121 }
122
128 public function getIsOnline()
129 {
130 return $this->isOnline;
131 }
132
138 public function setIsOnline($value = null)
139 {
140 $this->isOnline = $value;
141 }
142
146 public function extensions()
147 {
148 if ( $this->extensions !== null) {
149 return $this->extensions;
150 }
151
152 return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
153 }
154
158 public function unknownFieldSet()
159 {
161 }
162
166 public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
167 {
168 return new self($stream, $configuration);
169 }
170
174 public static function fromArray(array $values)
175 {
176 $message = new self();
177 $values = array_merge([
178 'id' => null,
179 'isPrivate' => null,
180 'isOnline' => null
181 ], $values);
182
183 $message->setId($values['id']);
184 $message->setIsPrivate($values['isPrivate']);
185 $message->setIsOnline($values['isOnline']);
186
187 return $message;
188 }
189
193 public static function descriptor()
194 {
195 return \google\protobuf\DescriptorProto::fromArray([
196 'name' => 'ChannelStats',
197 'field' => [
198 \google\protobuf\FieldDescriptorProto::fromArray([
199 'number' => 1,
200 'name' => 'id',
201 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
202 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
203 ]),
204 \google\protobuf\FieldDescriptorProto::fromArray([
205 'number' => 2,
206 'name' => 'isPrivate',
207 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(),
208 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
209 ]),
210 \google\protobuf\FieldDescriptorProto::fromArray([
211 'number' => 3,
212 'name' => 'isOnline',
213 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(),
214 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
215 ]),
216 ],
217 ]);
218 }
219
223 public function toStream(\Protobuf\Configuration $configuration = null)
224 {
225 $config = $configuration ?: \Protobuf\Configuration::getInstance();
226 $context = $config->createWriteContext();
227 $stream = $context->getStream();
228
229 $this->writeTo($context);
230 $stream->seek(0);
231
232 return $stream;
233 }
234
238 public function writeTo(\Protobuf\WriteContext $context)
239 {
240 $stream = $context->getStream();
241 $writer = $context->getWriter();
242 $sizeContext = $context->getComputeSizeContext();
243
244 if ($this->id !== null) {
245 $writer->writeVarint($stream, 10);
246 $writer->writeByteStream($stream, $this->id);
247 }
248
249 if ($this->isPrivate !== null) {
250 $writer->writeVarint($stream, 16);
251 $writer->writeBool($stream, $this->isPrivate);
252 }
253
254 if ($this->isOnline !== null) {
255 $writer->writeVarint($stream, 24);
256 $writer->writeBool($stream, $this->isOnline);
257 }
258
259 if ($this->extensions !== null) {
260 $this->extensions->writeTo($context);
261 }
262
263 return $stream;
264 }
265
269 public function readFrom(\Protobuf\ReadContext $context)
270 {
271 $reader = $context->getReader();
272 $length = $context->getLength();
273 $stream = $context->getStream();
274
275 $limit = ($length !== null)
276 ? ($stream->tell() + $length)
277 : null;
278
279 while ($limit === null || $stream->tell() < $limit) {
280
281 if ($stream->eof()) {
282 break;
283 }
284
285 $key = $reader->readVarint($stream);
286 $wire = \Protobuf\WireFormat::getTagWireType($key);
287 $tag = \Protobuf\WireFormat::getTagFieldNumber($key);
288
289 if ($stream->eof()) {
290 break;
291 }
292
293 if ($tag === 1) {
294 \Protobuf\WireFormat::assertWireType($wire, 12);
295
296 $this->id = $reader->readByteStream($stream);
297
298 continue;
299 }
300
301 if ($tag === 2) {
302 \Protobuf\WireFormat::assertWireType($wire, 8);
303
304 $this->isPrivate = $reader->readBool($stream);
305
306 continue;
307 }
308
309 if ($tag === 3) {
310 \Protobuf\WireFormat::assertWireType($wire, 8);
311
312 $this->isOnline = $reader->readBool($stream);
313
314 continue;
315 }
316
317 $extensions = $context->getExtensionRegistry();
318 $extension = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
319
320 if ($extension !== null) {
321 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
322
323 continue;
324 }
325
326 if ($this->unknownFieldSet === null) {
327 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
328 }
329
330 $data = $reader->readUnknown($stream, $wire);
331 $unknown = new \Protobuf\Unknown($tag, $wire, $data);
332
333 $this->unknownFieldSet->add($unknown);
334
335 }
336 }
337
341 public function serializedSize(\Protobuf\ComputeSizeContext $context)
342 {
343 $calculator = $context->getSizeCalculator();
344 $size = 0;
345
346 if ($this->id !== null) {
347 $size += 1;
348 $size += $calculator->computeByteStreamSize($this->id);
349 }
350
351 if ($this->isPrivate !== null) {
352 $size += 1;
353 $size += 1;
354 }
355
356 if ($this->isOnline !== null) {
357 $size += 1;
358 $size += 1;
359 }
360
361 if ($this->extensions !== null) {
362 $size += $this->extensions->serializedSize($context);
363 }
364
365 return $size;
366 }
367
371 public function clear()
372 {
373 $this->id = null;
374 $this->isPrivate = null;
375 $this->isOnline = null;
376 }
377
381 public function merge(\Protobuf\Message $message)
382 {
383 if ( ! $message instanceof \Bitrix\Pull\Protobuf\ChannelStats) {
384 throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
385 }
386
387 $this->id = ($message->id !== null) ? $message->id : $this->id;
388 $this->isPrivate = ($message->isPrivate !== null) ? $message->isPrivate : $this->isPrivate;
389 $this->isOnline = ($message->isOnline !== null) ? $message->isOnline : $this->isOnline;
390 }
391
392
393}
394
writeTo(\Protobuf\WriteContext $context)
toStream(\Protobuf\Configuration $configuration=null)
serializedSize(\Protobuf\ComputeSizeContext $context)
merge(\Protobuf\Message $message)
static fromStream($stream, \Protobuf\Configuration $configuration=null)
static fromArray(array $values)
readFrom(\Protobuf\ReadContext $context)