Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
request.php
1<?
2
4
15class Request extends \Protobuf\AbstractMessage
16{
17
21 protected $unknownFieldSet = null;
22
26 protected $extensions = null;
27
33 protected $incomingMessages = null;
34
40 protected $channelStats = null;
41
47 protected $serverStats = null;
48
54 public function hasIncomingMessages()
55 {
56 return $this->incomingMessages !== null;
57 }
58
64 public function getIncomingMessages()
65 {
67 }
68
74 public function setIncomingMessages(\Bitrix\Pull\Protobuf\IncomingMessagesRequest $value = null)
75 {
76 $this->incomingMessages = $value;
77 }
78
84 public function hasChannelStats()
85 {
86 return $this->channelStats !== null;
87 }
88
94 public function getChannelStats()
95 {
97 }
98
104 public function setChannelStats(\Bitrix\Pull\Protobuf\ChannelStatsRequest $value = null)
105 {
106 $this->channelStats = $value;
107 }
108
114 public function hasServerStats()
115 {
116 return $this->serverStats !== null;
117 }
118
124 public function getServerStats()
125 {
126 return $this->serverStats;
127 }
128
134 public function setServerStats(\Bitrix\Pull\Protobuf\ServerStatsRequest $value = null)
135 {
136 $this->serverStats = $value;
137 }
138
142 public function extensions()
143 {
144 if ( $this->extensions !== null) {
145 return $this->extensions;
146 }
147
148 return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
149 }
150
154 public function unknownFieldSet()
155 {
157 }
158
162 public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
163 {
164 return new self($stream, $configuration);
165 }
166
170 public static function fromArray(array $values)
171 {
172 $message = new self();
173 $values = array_merge([
174 'incomingMessages' => null,
175 'channelStats' => null,
176 'serverStats' => null
177 ], $values);
178
179 $message->setIncomingMessages($values['incomingMessages']);
180 $message->setChannelStats($values['channelStats']);
181 $message->setServerStats($values['serverStats']);
182
183 return $message;
184 }
185
189 public static function descriptor()
190 {
191 return \google\protobuf\DescriptorProto::fromArray([
192 'name' => 'Request',
193 'field' => [
194 \google\protobuf\FieldDescriptorProto::fromArray([
195 'number' => 1,
196 'name' => 'incomingMessages',
197 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
198 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
199 'type_name' => '.IncomingMessagesRequest'
200 ]),
201 \google\protobuf\FieldDescriptorProto::fromArray([
202 'number' => 2,
203 'name' => 'channelStats',
204 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
205 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
206 'type_name' => '.ChannelStatsRequest'
207 ]),
208 \google\protobuf\FieldDescriptorProto::fromArray([
209 'number' => 3,
210 'name' => 'serverStats',
211 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
212 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
213 'type_name' => '.ServerStatsRequest'
214 ]),
215 ],
216 ]);
217 }
218
222 public function toStream(\Protobuf\Configuration $configuration = null)
223 {
224 $config = $configuration ?: \Protobuf\Configuration::getInstance();
225 $context = $config->createWriteContext();
226 $stream = $context->getStream();
227
228 $this->writeTo($context);
229 $stream->seek(0);
230
231 return $stream;
232 }
233
237 public function writeTo(\Protobuf\WriteContext $context)
238 {
239 $stream = $context->getStream();
240 $writer = $context->getWriter();
241 $sizeContext = $context->getComputeSizeContext();
242
243 if ($this->incomingMessages !== null) {
244 $writer->writeVarint($stream, 10);
245 $writer->writeVarint($stream, $this->incomingMessages->serializedSize($sizeContext));
246 $this->incomingMessages->writeTo($context);
247 }
248
249 if ($this->channelStats !== null) {
250 $writer->writeVarint($stream, 18);
251 $writer->writeVarint($stream, $this->channelStats->serializedSize($sizeContext));
252 $this->channelStats->writeTo($context);
253 }
254
255 if ($this->serverStats !== null) {
256 $writer->writeVarint($stream, 26);
257 $writer->writeVarint($stream, $this->serverStats->serializedSize($sizeContext));
258 $this->serverStats->writeTo($context);
259 }
260
261 if ($this->extensions !== null) {
262 $this->extensions->writeTo($context);
263 }
264
265 return $stream;
266 }
267
271 public function readFrom(\Protobuf\ReadContext $context)
272 {
273 $reader = $context->getReader();
274 $length = $context->getLength();
275 $stream = $context->getStream();
276
277 $limit = ($length !== null)
278 ? ($stream->tell() + $length)
279 : null;
280
281 while ($limit === null || $stream->tell() < $limit) {
282
283 if ($stream->eof()) {
284 break;
285 }
286
287 $key = $reader->readVarint($stream);
288 $wire = \Protobuf\WireFormat::getTagWireType($key);
289 $tag = \Protobuf\WireFormat::getTagFieldNumber($key);
290
291 if ($stream->eof()) {
292 break;
293 }
294
295 if ($tag === 1) {
296 \Protobuf\WireFormat::assertWireType($wire, 11);
297
298 $innerSize = $reader->readVarint($stream);
299 $innerMessage = new \Bitrix\Pull\Protobuf\IncomingMessagesRequest();
300
301 $this->incomingMessages = $innerMessage;
302
303 $context->setLength($innerSize);
304 $innerMessage->readFrom($context);
305 $context->setLength($length);
306
307 continue;
308 }
309
310 if ($tag === 2) {
311 \Protobuf\WireFormat::assertWireType($wire, 11);
312
313 $innerSize = $reader->readVarint($stream);
314 $innerMessage = new \Bitrix\Pull\Protobuf\ChannelStatsRequest();
315
316 $this->channelStats = $innerMessage;
317
318 $context->setLength($innerSize);
319 $innerMessage->readFrom($context);
320 $context->setLength($length);
321
322 continue;
323 }
324
325 if ($tag === 3) {
326 \Protobuf\WireFormat::assertWireType($wire, 11);
327
328 $innerSize = $reader->readVarint($stream);
329 $innerMessage = new \Bitrix\Pull\Protobuf\ServerStatsRequest();
330
331 $this->serverStats = $innerMessage;
332
333 $context->setLength($innerSize);
334 $innerMessage->readFrom($context);
335 $context->setLength($length);
336
337 continue;
338 }
339
340 $extensions = $context->getExtensionRegistry();
341 $extension = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
342
343 if ($extension !== null) {
344 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
345
346 continue;
347 }
348
349 if ($this->unknownFieldSet === null) {
350 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
351 }
352
353 $data = $reader->readUnknown($stream, $wire);
354 $unknown = new \Protobuf\Unknown($tag, $wire, $data);
355
356 $this->unknownFieldSet->add($unknown);
357
358 }
359 }
360
364 public function serializedSize(\Protobuf\ComputeSizeContext $context)
365 {
366 $calculator = $context->getSizeCalculator();
367 $size = 0;
368
369 if ($this->incomingMessages !== null) {
370 $innerSize = $this->incomingMessages->serializedSize($context);
371
372 $size += 1;
373 $size += $innerSize;
374 $size += $calculator->computeVarintSize($innerSize);
375 }
376
377 if ($this->channelStats !== null) {
378 $innerSize = $this->channelStats->serializedSize($context);
379
380 $size += 1;
381 $size += $innerSize;
382 $size += $calculator->computeVarintSize($innerSize);
383 }
384
385 if ($this->serverStats !== null) {
386 $innerSize = $this->serverStats->serializedSize($context);
387
388 $size += 1;
389 $size += $innerSize;
390 $size += $calculator->computeVarintSize($innerSize);
391 }
392
393 if ($this->extensions !== null) {
394 $size += $this->extensions->serializedSize($context);
395 }
396
397 return $size;
398 }
399
403 public function clear()
404 {
405 $this->incomingMessages = null;
406 $this->channelStats = null;
407 $this->serverStats = null;
408 }
409
413 public function merge(\Protobuf\Message $message)
414 {
415 if ( ! $message instanceof \Bitrix\Pull\Protobuf\Request) {
416 throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
417 }
418
419 $this->incomingMessages = ($message->incomingMessages !== null) ? $message->incomingMessages : $this->incomingMessages;
420 $this->channelStats = ($message->channelStats !== null) ? $message->channelStats : $this->channelStats;
421 $this->serverStats = ($message->serverStats !== null) ? $message->serverStats : $this->serverStats;
422 }
423
424
425}
426
writeTo(\Protobuf\WriteContext $context)
Definition request.php:237
toStream(\Protobuf\Configuration $configuration=null)
Definition request.php:222
setChannelStats(\Bitrix\Pull\Protobuf\ChannelStatsRequest $value=null)
Definition request.php:104
serializedSize(\Protobuf\ComputeSizeContext $context)
Definition request.php:364
setIncomingMessages(\Bitrix\Pull\Protobuf\IncomingMessagesRequest $value=null)
Definition request.php:74
merge(\Protobuf\Message $message)
Definition request.php:413
static fromStream($stream, \Protobuf\Configuration $configuration=null)
Definition request.php:162
static fromArray(array $values)
Definition request.php:170
readFrom(\Protobuf\ReadContext $context)
Definition request.php:271
setServerStats(\Bitrix\Pull\Protobuf\ServerStatsRequest $value=null)
Definition request.php:134