Your IP : 52.14.234.6


Current Path : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/modules/pull/lib/protobuf/
Upload File :
Current File : /home/bitrix/ext_www/crm.klimatlend.ua/bitrix/modules/pull/lib/protobuf/request.php

<?

namespace Bitrix\Pull\Protobuf;

/**
 * Generated by Protobuf protoc plugin.
 *
 * File descriptor : request.proto
 */


/**
 * Protobuf message : Request
 */
class Request extends \Protobuf\AbstractMessage
{

    /**
     * @var \Protobuf\UnknownFieldSet
     */
    protected $unknownFieldSet = null;

    /**
     * @var \Protobuf\Extension\ExtensionFieldMap
     */
    protected $extensions = null;

    /**
     * incomingMessages optional message = 1
     *
     * @var \Bitrix\Pull\Protobuf\IncomingMessagesRequest
     */
    protected $incomingMessages = null;

    /**
     * channelStats optional message = 2
     *
     * @var \Bitrix\Pull\Protobuf\ChannelStatsRequest
     */
    protected $channelStats = null;

    /**
     * serverStats optional message = 3
     *
     * @var \Bitrix\Pull\Protobuf\ServerStatsRequest
     */
    protected $serverStats = null;

    /**
     * Check if 'incomingMessages' has a value
     *
     * @return bool
     */
    public function hasIncomingMessages()
    {
        return $this->incomingMessages !== null;
    }

    /**
     * Get 'incomingMessages' value
     *
     * @return \Bitrix\Pull\Protobuf\IncomingMessagesRequest
     */
    public function getIncomingMessages()
    {
        return $this->incomingMessages;
    }

    /**
     * Set 'incomingMessages' value
     *
     * @param \Bitrix\Pull\Protobuf\IncomingMessagesRequest $value
     */
    public function setIncomingMessages(\Bitrix\Pull\Protobuf\IncomingMessagesRequest $value = null)
    {
        $this->incomingMessages = $value;
    }

    /**
     * Check if 'channelStats' has a value
     *
     * @return bool
     */
    public function hasChannelStats()
    {
        return $this->channelStats !== null;
    }

    /**
     * Get 'channelStats' value
     *
     * @return \Bitrix\Pull\Protobuf\ChannelStatsRequest
     */
    public function getChannelStats()
    {
        return $this->channelStats;
    }

    /**
     * Set 'channelStats' value
     *
     * @param \Bitrix\Pull\Protobuf\ChannelStatsRequest $value
     */
    public function setChannelStats(\Bitrix\Pull\Protobuf\ChannelStatsRequest $value = null)
    {
        $this->channelStats = $value;
    }

    /**
     * Check if 'serverStats' has a value
     *
     * @return bool
     */
    public function hasServerStats()
    {
        return $this->serverStats !== null;
    }

    /**
     * Get 'serverStats' value
     *
     * @return \Bitrix\Pull\Protobuf\ServerStatsRequest
     */
    public function getServerStats()
    {
        return $this->serverStats;
    }

    /**
     * Set 'serverStats' value
     *
     * @param \Bitrix\Pull\Protobuf\ServerStatsRequest $value
     */
    public function setServerStats(\Bitrix\Pull\Protobuf\ServerStatsRequest $value = null)
    {
        $this->serverStats = $value;
    }

    /**
     * {@inheritdoc}
     */
    public function extensions()
    {
        if ( $this->extensions !== null) {
            return $this->extensions;
        }

        return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    }

    /**
     * {@inheritdoc}
     */
    public function unknownFieldSet()
    {
        return $this->unknownFieldSet;
    }

    /**
     * {@inheritdoc}
     */
    public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    {
        return new self($stream, $configuration);
    }

    /**
     * {@inheritdoc}
     */
    public static function fromArray(array $values)
    {
        $message = new self();
        $values  = array_merge([
            'incomingMessages' => null,
            'channelStats' => null,
            'serverStats' => null
        ], $values);

        $message->setIncomingMessages($values['incomingMessages']);
        $message->setChannelStats($values['channelStats']);
        $message->setServerStats($values['serverStats']);

        return $message;
    }

    /**
     * {@inheritdoc}
     */
    public static function descriptor()
    {
        return \google\protobuf\DescriptorProto::fromArray([
            'name'      => 'Request',
            'field'     => [
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 1,
                    'name' => 'incomingMessages',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
                    'type_name' => '.IncomingMessagesRequest'
                ]),
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 2,
                    'name' => 'channelStats',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
                    'type_name' => '.ChannelStatsRequest'
                ]),
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 3,
                    'name' => 'serverStats',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
                    'type_name' => '.ServerStatsRequest'
                ]),
            ],
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function toStream(\Protobuf\Configuration $configuration = null)
    {
        $config  = $configuration ?: \Protobuf\Configuration::getInstance();
        $context = $config->createWriteContext();
        $stream  = $context->getStream();

        $this->writeTo($context);
        $stream->seek(0);

        return $stream;
    }

    /**
     * {@inheritdoc}
     */
    public function writeTo(\Protobuf\WriteContext $context)
    {
        $stream      = $context->getStream();
        $writer      = $context->getWriter();
        $sizeContext = $context->getComputeSizeContext();

        if ($this->incomingMessages !== null) {
            $writer->writeVarint($stream, 10);
            $writer->writeVarint($stream, $this->incomingMessages->serializedSize($sizeContext));
            $this->incomingMessages->writeTo($context);
        }

        if ($this->channelStats !== null) {
            $writer->writeVarint($stream, 18);
            $writer->writeVarint($stream, $this->channelStats->serializedSize($sizeContext));
            $this->channelStats->writeTo($context);
        }

        if ($this->serverStats !== null) {
            $writer->writeVarint($stream, 26);
            $writer->writeVarint($stream, $this->serverStats->serializedSize($sizeContext));
            $this->serverStats->writeTo($context);
        }

        if ($this->extensions !== null) {
            $this->extensions->writeTo($context);
        }

        return $stream;
    }

    /**
     * {@inheritdoc}
     */
    public function readFrom(\Protobuf\ReadContext $context)
    {
        $reader = $context->getReader();
        $length = $context->getLength();
        $stream = $context->getStream();

        $limit = ($length !== null)
            ? ($stream->tell() + $length)
            : null;

        while ($limit === null || $stream->tell() < $limit) {

            if ($stream->eof()) {
                break;
            }

            $key  = $reader->readVarint($stream);
            $wire = \Protobuf\WireFormat::getTagWireType($key);
            $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);

            if ($stream->eof()) {
                break;
            }

            if ($tag === 1) {
                \Protobuf\WireFormat::assertWireType($wire, 11);

                $innerSize    = $reader->readVarint($stream);
                $innerMessage = new \Bitrix\Pull\Protobuf\IncomingMessagesRequest();

                $this->incomingMessages = $innerMessage;

                $context->setLength($innerSize);
                $innerMessage->readFrom($context);
                $context->setLength($length);

                continue;
            }

            if ($tag === 2) {
                \Protobuf\WireFormat::assertWireType($wire, 11);

                $innerSize    = $reader->readVarint($stream);
                $innerMessage = new \Bitrix\Pull\Protobuf\ChannelStatsRequest();

                $this->channelStats = $innerMessage;

                $context->setLength($innerSize);
                $innerMessage->readFrom($context);
                $context->setLength($length);

                continue;
            }

            if ($tag === 3) {
                \Protobuf\WireFormat::assertWireType($wire, 11);

                $innerSize    = $reader->readVarint($stream);
                $innerMessage = new \Bitrix\Pull\Protobuf\ServerStatsRequest();

                $this->serverStats = $innerMessage;

                $context->setLength($innerSize);
                $innerMessage->readFrom($context);
                $context->setLength($length);

                continue;
            }

            $extensions = $context->getExtensionRegistry();
            $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;

            if ($extension !== null) {
                $this->extensions()->add($extension, $extension->readFrom($context, $wire));

                continue;
            }

            if ($this->unknownFieldSet === null) {
                $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
            }

            $data    = $reader->readUnknown($stream, $wire);
            $unknown = new \Protobuf\Unknown($tag, $wire, $data);

            $this->unknownFieldSet->add($unknown);

        }
    }

    /**
     * {@inheritdoc}
     */
    public function serializedSize(\Protobuf\ComputeSizeContext $context)
    {
        $calculator = $context->getSizeCalculator();
        $size       = 0;

        if ($this->incomingMessages !== null) {
            $innerSize = $this->incomingMessages->serializedSize($context);

            $size += 1;
            $size += $innerSize;
            $size += $calculator->computeVarintSize($innerSize);
        }

        if ($this->channelStats !== null) {
            $innerSize = $this->channelStats->serializedSize($context);

            $size += 1;
            $size += $innerSize;
            $size += $calculator->computeVarintSize($innerSize);
        }

        if ($this->serverStats !== null) {
            $innerSize = $this->serverStats->serializedSize($context);

            $size += 1;
            $size += $innerSize;
            $size += $calculator->computeVarintSize($innerSize);
        }

        if ($this->extensions !== null) {
            $size += $this->extensions->serializedSize($context);
        }

        return $size;
    }

    /**
     * {@inheritdoc}
     */
    public function clear()
    {
        $this->incomingMessages = null;
        $this->channelStats = null;
        $this->serverStats = null;
    }

    /**
     * {@inheritdoc}
     */
    public function merge(\Protobuf\Message $message)
    {
        if ( ! $message instanceof \Bitrix\Pull\Protobuf\Request) {
            throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
        }

        $this->incomingMessages = ($message->incomingMessages !== null) ? $message->incomingMessages : $this->incomingMessages;
        $this->channelStats = ($message->channelStats !== null) ? $message->channelStats : $this->channelStats;
        $this->serverStats = ($message->serverStats !== null) ? $message->serverStats : $this->serverStats;
    }


}