uawdijnntqw1x1x1
IP : 18.222.230.215
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
arhangelsk.axolotls.ru
/
a537b
/
vendor.tar
/
/
Protobuf/Collection.php000066400000000306147735112210011154 0ustar00<?php namespace Protobuf; use Traversable; use Countable; /** * Collection. * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ interface Collection extends Countable, Traversable { } Protobuf/TextFormat.php000066400000006244147735112210011165 0ustar00<?php namespace Protobuf; use Traversable; use Protobuf\Enum; use Protobuf\Stream; use ReflectionClass; use ReflectionProperty; use Protobuf\MessageInterface; /** * This serializes to text format * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class TextFormat { /** * @param \Protobuf\Message $message * @param integer $level * * @return \Protobuf\Stream */ public function encodeMessage(Message $message, $level = 0) { $reflect = new ReflectionClass($message); $properties = $reflect->getProperties(ReflectionProperty::IS_PROTECTED); $indent = str_repeat(' ', $level); $stream = Stream::create(); foreach ($properties as $property) { $property->setAccessible(true); $name = $property->getName(); $value = $property->getValue($message); if ($value === null) { continue; } if ( ! is_array($value) && ! ($value instanceof Traversable)) { if ( ! $value instanceof Message) { $item = $this->encodeValue($value); $buffer = $indent . $name . ': ' . $item . PHP_EOL; $stream->write($buffer, strlen($buffer)); continue; } $innerStream = $this->encodeMessage($value, $level + 1); $beginMessage = $indent . $name . ' {' . PHP_EOL; $endMessage = $indent . '}' . PHP_EOL; $stream->write($beginMessage, strlen($beginMessage)); $stream->writeStream($innerStream, $innerStream->getSize()); $stream->write($endMessage, strlen($endMessage)); continue; } foreach ($value as $val) { // Skip nullified repeated values if ($val == null) { continue; } if ( ! $val instanceof Message) { $item = $this->encodeValue($val); $buffer = $indent . $name . ': ' . $item . PHP_EOL; $stream->write($buffer, strlen($buffer)); continue; } $innerStream = $this->encodeMessage($val, $level + 1); $beginMessage = $indent . $name . ' {' . PHP_EOL; $endMessage = $indent . '}' . PHP_EOL; $stream->write($beginMessage, strlen($beginMessage)); $stream->writeStream($innerStream, $innerStream->getSize()); $stream->write($endMessage, strlen($endMessage)); } } $stream->seek(0); return $stream; } /** * @param scalar|array $value * * @return string */ public function encodeValue($value) { if (is_bool($value)) { return (int) $value; } if ($value instanceof Enum) { return $value->name(); } if ($value instanceof Stream) { return json_encode($value->__toString()); } return json_encode($value); } } Protobuf/Unknown.php000066400000001146147735112210010523 0ustar00<?php namespace Protobuf; /** * Unknown value * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class Unknown { /** * @var integer */ public $tag; /** * @var integer */ public $type; /** * @var mixed */ public $value; /** * @param integer $tag * @param integer $type * @param mixed $value */ public function __construct($tag = 0, $type = null, $value = null) { $this->tag = $tag; $this->type = $type; $this->value = $value; } } Protobuf/Binary/StreamWriter.php000066400000016040147735112210012737 0ustar00<?php namespace Protobuf\Binary; use Protobuf\Stream; use Protobuf\WireFormat; use Protobuf\Configuration; use Protobuf\Binary\Platform\BigEndian; /** * Implements writing primitives for Protobuf binary streams. * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class StreamWriter { /** * @var \Protobuf\Configuration */ protected $config; /** * @var \Protobuf\Binary\Platform\NegativeEncoder */ protected $negativeEncoder; /** * @var bool */ protected $isBigEndian; /** * Constructor * * @param \Protobuf\Configuration $config */ public function __construct(Configuration $config) { $this->config = $config; $this->isBigEndian = BigEndian::isBigEndian(); $this->negativeEncoder = $config->getPlatformFactory() ->getNegativeEncoder(); } /** * Store the given bytes in the stream. * * @param \Protobuf\Stream $stream * @param string $bytes * @param int $length */ public function writeBytes(Stream $stream, $bytes, $length = null) { if ($length === null) { $length = mb_strlen($bytes, '8bit'); } $stream->write($bytes, $length); } /** * Store a single byte. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeByte(Stream $stream, $value) { $stream->write(chr($value), 1); } /** * Store an integer encoded as varint. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeVarint(Stream $stream, $value) { // Small values do not need to be encoded if ($value >= 0 && $value < 0x80) { $this->writeByte($stream, $value); return; } $values = null; // Build an array of bytes with the encoded values if ($value > 0) { $values = []; while ($value > 0) { $values[] = 0x80 | ($value & 0x7f); $value = $value >> 7; } } if ($values === null) { $values = $this->negativeEncoder->encodeVarint($value); } // Remove the MSB flag from the last byte $values[count($values) - 1] &= 0x7f; // Convert the byte sized ints to actual bytes in a string $values = array_merge(['C*'], $values); $bytes = call_user_func_array('pack', $values); $this->writeBytes($stream, $bytes); } /** * Encodes an integer with zigzag. * * @param \Protobuf\Stream $stream * @param integer $value * @param integer $base */ public function writeZigzag(Stream $stream, $value, $base = 32) { if ($base == 32) { $this->writeZigzag32($stream, $value); return; } $this->writeZigzag64($stream, $value); } /** * Encodes an integer with zigzag. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeZigzag32(Stream $stream, $value) { $this->writeVarint($stream, ($value << 1) ^ ($value >> 32 - 1)); } /** * Encodes an integer with zigzag. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeZigzag64(Stream $stream, $value) { $this->writeVarint($stream, ($value << 1) ^ ($value >> 64 - 1)); } /** * Encode an integer as a fixed of 32bits with sign. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeSFixed32(Stream $stream, $value) { $bytes = pack('l*', $value); if ($this->isBigEndian) { $bytes = strrev($bytes); } $this->writeBytes($stream, $bytes); } /** * Encode an integer as a fixed of 32bits without sign. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeFixed32(Stream $stream, $value) { $this->writeBytes($stream, pack('V*', $value), 4); } /** * Encode an integer as a fixed of 64bits with sign. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeSFixed64(Stream $stream, $value) { if ($value >= 0) { $this->writeFixed64($stream, $value); return; } $bytes = $this->negativeEncoder->encodeSFixed64($value); $this->writeBytes($stream, $bytes); } /** * Encode an integer as a fixed of 64bits without sign. * * @param \Protobuf\Stream $stream * @param integer $value */ public function writeFixed64(Stream $stream, $value) { $bytes = pack('V*', $value & 0xffffffff, $value / (0xffffffff + 1)); $this->writeBytes($stream, $bytes, 8); } /** * Encode a number as a 32bit float. * * @param \Protobuf\Stream $stream * @param float $value */ public function writeFloat(Stream $stream, $value) { $bytes = pack('f*', $value); if ($this->isBigEndian) { $bytes = strrev($bytes); } $this->writeBytes($stream, $bytes, 4); } /** * Encode a number as a 64bit double. * * @param \Protobuf\Stream $stream * @param float $value */ public function writeDouble(Stream $stream, $value) { $bytes = pack('d*', $value); if ($this->isBigEndian) { $bytes = strrev($bytes); } $this->writeBytes($stream, $bytes, 8); } /** * Encode a bool. * * @param \Protobuf\Stream $stream * @param bool $value */ public function writeBool(Stream $stream, $value) { $this->writeVarint($stream, $value ? 1 : 0); } /** * Encode a string. * * @param \Protobuf\Stream $stream * @param string $value */ public function writeString(Stream $stream, $value) { $this->writeVarint($stream, mb_strlen($value, '8bit')); $this->writeBytes($stream, $value); } /** * Encode a stream of bytes. * * @param \Protobuf\Stream $stream * @param \Protobuf\Stream $value */ public function writeByteStream(Stream $stream, Stream $value) { $length = $value->getSize(); $value->seek(0); $this->writeVarint($stream, $length); $stream->writeStream($value, $length); } /** * Write the given stream. * * @param \Protobuf\Stream $stream * @param \Protobuf\Stream $value * @param int $length */ public function writeStream(Stream $stream, Stream $value, $length = null) { if ($length === null) { $length = $value->getSize(); } $stream->writeStream($value, $length); } } Protobuf/Binary/SizeCalculator.php000066400000010464147735112210013237 0ustar00<?php namespace Protobuf\Binary; use Protobuf\Binary\Platform\BigEndian; use Protobuf\MessageInterface; use Protobuf\Configuration; use Protobuf\WireFormat; use Protobuf\Unknown; use Protobuf\Stream; /** * Compute the number of bytes that would be needed to encode a value * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class SizeCalculator { /** * @var \Protobuf\Configuration */ protected $config; /** * Constructor * * @param \Protobuf\Configuration $config */ public function __construct(Configuration $config) { $this->config = $config; } /** * Compute the number of bytes that would be needed to encode a varint. * * @param integer $value * * @return integer */ public function computeVarintSize($value) { if (($value & (0xffffffff << 7)) === 0) { return 1; } if (($value & (0xffffffff << 14)) === 0) { return 2; } if (($value & (0xffffffff << 21)) === 0) { return 3; } if (($value & (0xffffffff << 28)) === 0) { return 4; } if (($value & (0xffffffff << 35)) === 0) { return 5; } if (($value & (0xffffffff << 42)) === 0) { return 6; } if (($value & (0xffffffff << 49)) === 0) { return 7; } if (($value & (0xffffffff << 56)) === 0) { return 8; } if (($value & (0xffffffff << 63)) === 0) { return 9; } return 10; } /** * Compute the number of bytes that would be needed to encode a zigzag 32. * * @param integer $value * * @return integer */ public function computeZigzag32Size($value) { $varint = ($value << 1) ^ ($value >> 32 - 1); $size = $this->computeVarintSize($varint); return $size; } /** * Compute the number of bytes that would be needed to encode a zigzag 64. * * @param integer $value * * @return integer */ public function computeZigzag64Size($value) { $varint = ($value << 1) ^ ($value >> 64 - 1); $size = $this->computeVarintSize($varint); return $size; } /** * Compute the number of bytes that would be needed to encode a string. * * @param integer $value * * @return integer */ public function computeStringSize($value) { $length = mb_strlen($value, '8bit'); $size = $length + $this->computeVarintSize($length); return $size; } /** * Compute the number of bytes that would be needed to encode a stream of bytes. * * @param \Protobuf\Stream $value * * @return integer */ public function computeByteStreamSize(Stream $value) { $length = $value->getSize(); $size = $length + $this->computeVarintSize($length); return $size; } /** * Compute the number of bytes that would be needed to encode a sFixed32. * * @return integer */ public function computeSFixed32Size() { return 4; } /** * Compute the number of bytes that would be needed to encode a fixed32. * * @return integer */ public function computeFixed32Size() { return 4; } /** * Compute the number of bytes that would be needed to encode a sFixed64. * * @return integer */ public function computeSFixed64Size() { return 8; } /** * Compute the number of bytes that would be needed to encode a fixed64. * * * @return integer */ public function computeFixed64Size() { return 8; } /** * Compute the number of bytes that would be needed to encode a float. * * @return integer */ public function computeFloatSize() { return 4; } /** * Compute the number of bytes that would be needed to encode a double. * * @return integer */ public function computeDoubleSize() { return 8; } /** * Compute the number of bytes that would be needed to encode a bool. * * @return integer */ public function computeBoolSize() { return 1; } } Protobuf/Binary/StreamReader.php000066400000015646147735112210012700 0ustar00<?php namespace Protobuf\Binary; use Protobuf\Binary\Platform\BigEndian; use Protobuf\MessageInterface; use Protobuf\Configuration; use Protobuf\WireFormat; use Protobuf\Unknown; use Protobuf\Stream; use RuntimeException; /** * Implements reading primitives for Protobuf binary streams. * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class StreamReader { /** * @var \Protobuf\Configuration */ protected $config; /** * @var \Protobuf\Stream */ protected $stream; /** * @var bool */ protected $isBigEndian; /** * Constructor * * @param \Protobuf\Configuration $config */ public function __construct(Configuration $config) { $this->config = $config; $this->isBigEndian = BigEndian::isBigEndian(); } /** * Reads a byte. * * @param \Protobuf\Stream $stream * * @return integer */ public function readByte(Stream $stream) { $char = $stream->read(1); $byte = ord($char); return $byte; } /** * Decode a varint. * * @param \Protobuf\Stream $stream * * @return integer */ public function readVarint(Stream $stream) { // Optimize common case (single byte varints) $byte = $this->readByte($stream); if ($byte < 0x80) { return $byte; } $length = $stream->getSize(); $offset = $stream->tell(); $result = $byte & 0x7f; $shift = 7; // fastpath 32bit varints (5bytes) by unrolling the loop if ($length - $offset >= 4) { // 2 $byte = $this->readByte($stream); $result |= ($byte & 0x7f) << 7; if ($byte < 0x80) { return $result; } // 3 $byte = $this->readByte($stream); $result |= ($byte & 0x7f) << 14; if ($byte < 0x80) { return $result; } // 4 $byte = $this->readByte($stream); $result |= ($byte & 0x7f) << 21; if ($byte < 0x80) { return $result; } // 5 $byte = $this->readByte($stream); $result |= ($byte & 0x7f) << 28; if ($byte < 0x80) { return $result; } $shift = 35; } // If we're just at the end of the buffer or handling a 64bit varint do { $byte = $this->readByte($stream); $result |= ($byte & 0x7f) << $shift; $shift += 7; } while ($byte > 0x7f); return $result; } /** * Decodes a zigzag integer of the given bits. * * @param \Protobuf\Stream $stream * * @return integer */ public function readZigzag(Stream $stream) { $number = $this->readVarint($stream); $zigzag = ($number >> 1) ^ (-($number & 1)); return $zigzag; } /** * Decode a fixed 32bit integer with sign. * * @param \Protobuf\Stream $stream * * @return integer */ public function readSFixed32(Stream $stream) { $bytes = $stream->read(4); if ($this->isBigEndian) { $bytes = strrev($bytes); } list(, $result) = unpack('l', $bytes); return $result; } /** * Decode a fixed 32bit integer without sign. * * @param \Protobuf\Stream $stream * * @return integer */ public function readFixed32(Stream $stream) { $bytes = $stream->read(4); if (PHP_INT_SIZE < 8) { list(, $lo, $hi) = unpack('v*', $bytes); return $hi << 16 | $lo; } list(, $result) = unpack('V*', $bytes); return $result; } /** * Decode a fixed 64bit integer with sign. * * @param \Protobuf\Stream $stream * * @return integer */ public function readSFixed64(Stream $stream) { $bytes = $stream->read(8); list(, $lo0, $lo1, $hi0, $hi1) = unpack('v*', $bytes); return ($hi1 << 16 | $hi0) << 32 | ($lo1 << 16 | $lo0); } /** * Decode a fixed 64bit integer without sign. * * @param \Protobuf\Stream $stream * * @return integer */ public function readFixed64(Stream $stream) { return $this->readSFixed64($stream); } /** * Decode a 32bit float. * * @param \Protobuf\Stream $stream * * @return float */ public function readFloat(Stream $stream) { $bytes = $stream->read(4); if ($this->isBigEndian) { $bytes = strrev($bytes); } list(, $result) = unpack('f', $bytes); return $result; } /** * Decode a 64bit double. * * @param \Protobuf\Stream $stream * * @return float */ public function readDouble(Stream $stream) { $bytes = $stream->read(8); if ($this->isBigEndian) { $bytes = strrev($bytes); } list(, $result) = unpack('d', $bytes); return $result; } /** * Decode a bool. * * @param \Protobuf\Stream $stream * * @return bool */ public function readBool(Stream $stream) { return (bool) $this->readVarint($stream); } /** * Decode a string. * * @param \Protobuf\Stream $stream * * @return string */ public function readString(Stream $stream) { $length = $this->readVarint($stream); $string = $stream->read($length); return $string; } /** * Decode a stream of bytes. * * @param \Protobuf\Stream $stream * * @return \Protobuf\Stream */ public function readByteStream(Stream $stream) { $length = $this->readVarint($stream); $value = $stream->readStream($length); return $value; } /** * Read unknown scalar value. * * @param \Protobuf\Stream $stream * @param integer $wire * * @return scalar */ public function readUnknown(Stream $stream, $wire) { if ($wire === WireFormat::WIRE_VARINT) { return $this->readVarint($stream); } if ($wire === WireFormat::WIRE_LENGTH) { return $this->readString($stream); } if ($wire === WireFormat::WIRE_FIXED32) { return $this->readFixed32($stream); } if ($wire === WireFormat::WIRE_FIXED64) { return $this->readFixed64($stream); } if ($wire === WireFormat::WIRE_GROUP_START || $wire === WireFormat::WIRE_GROUP_END) { throw new RuntimeException('Groups are deprecated in Protocol Buffers and unsupported.'); } throw new RuntimeException("Unsupported wire type '$wire' while reading unknown field."); } } Protobuf/Binary/Platform/BigEndian.php000066400000001710147735112210013711 0ustar00<?php namespace Protobuf\Binary\Platform; /** * Check current architecture * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class BigEndian { /** * @var bool */ protected static $is32Bit; /** * @var integer */ protected static $isBigEndian; /** * Check if the current architecture is Big Endian. * * @return bool */ public static function isBigEndian() { if (self::$isBigEndian !== null) { return self::$isBigEndian; } list(, $result) = unpack('L', pack('V', 1)); self::$isBigEndian = $result !== 1; return self::$isBigEndian; } /** * @return bool */ public static function is32Bit() { if (self::$is32Bit !== null) { self::$is32Bit; } self::$is32Bit = (PHP_INT_SIZE < 8); return self::$is32Bit; } } Protobuf/Binary/Platform/NegativeEncoder.php000066400000001020147735112210015125 0ustar00<?php namespace Protobuf\Binary\Platform; /** * Implements platform specific encoding of negative values. * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ interface NegativeEncoder { /** * Encode a negative varint. * * @param integer $value * * @return array */ public function encodeVarint($value); /** * Encode an integer as a fixed of 64bits. * * @param integer $value * * @return string */ public function encodeSFixed64($value); } Protobuf/Binary/Platform/BcNegativeEncoder.php000066400000003034147735112210015401 0ustar00<?php namespace Protobuf\Binary\Platform; use RuntimeException; /** * BC math negative values enconding. * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class BcNegativeEncoder implements NegativeEncoder { /** * {@inheritdoc} */ public function encodeVarint($varint) { $values = []; $value = sprintf('%u', $varint); while (bccomp($value, 0, 0) > 0) { // Get the last 7bits of the number $bin = ''; $dec = $value; do { $rest = bcmod($dec, 2); $dec = bcdiv($dec, 2, 0); $bin = $rest . $bin; } while ($dec > 0 && mb_strlen($bin, '8bit') < 7); // Pack as a decimal and apply the flag $values[] = intval($bin, 2) | 0x80; $value = bcdiv($value, 0x80, 0); } return $values; } /** * {@inheritdoc} */ public function encodeSFixed64($sFixed64) { $value = sprintf('%u', $sFixed64); $bytes = ''; for ($i = 0; $i < 8; ++$i) { // Get the last 8bits of the number $bin = ''; $dec = $value; do { $bin = bcmod($dec, 2).$bin; $dec = bcdiv($dec, 2, 0); } while (mb_strlen($bin, '8bit') < 8); // Pack the byte $bytes .= chr(intval($bin, 2)); $value = bcdiv($value, 0x100, 0); } return $bytes; } } Protobuf/Binary/Platform/InvalidNegativeEncoder.php000066400000001207147735112210016443 0ustar00<?php namespace Protobuf\Binary\Platform; use RuntimeException; /** * Invalid platform for negative values * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class InvalidNegativeEncoder implements NegativeEncoder { /** * {@inheritdoc} */ public function encodeVarint($varint) { throw new RuntimeException("Negative integers are only supported with GMP or BC (64bit) intextensions."); } /** * {@inheritdoc} */ public function encodeSFixed64($sFixed64) { throw new RuntimeException("Negative integers are only supported with GMP or BC (64bit) intextensions."); } } Protobuf/Binary/Platform/PlatformFactory.php000066400000002242147735112210015206 0ustar00<?php namespace Protobuf\Binary\Platform; use RuntimeException; /** * Platform factory * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class PlatformFactory { /** * @var \Protobuf\Binary\Platform\NegativeEncoder */ private $negativeEncoder; /** * Return a NegativeEncoder. * * @return \Protobuf\Binary\Platform\NegativeEncoder */ public function getNegativeEncoder() { if ($this->negativeEncoder !== null) { return $this->negativeEncoder; } if ($this->isExtensionLoaded('gmp')) { return $this->negativeEncoder = new GmpNegativeEncoder(); } if ($this->isExtensionLoaded('bcmath') && ! $this->is32Bit()) { return $this->negativeEncoder = new BcNegativeEncoder(); } return $this->negativeEncoder = new InvalidNegativeEncoder(); } /** * @param string $name * * @return boolean */ public function isExtensionLoaded($name) { return extension_loaded($name); } /** * @return boolean */ public function is32Bit() { return BigEndian::is32Bit(); } } Protobuf/Binary/Platform/GmpNegativeEncoder.php000066400000003475147735112210015611 0ustar00<?php namespace Protobuf\Binary\Platform; /** * GMP negative values enconding. * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class GmpNegativeEncoder implements NegativeEncoder { /** * @var \GMP */ protected $gmp_x00; /** * @var \GMP */ protected $gmp_x7f; /** * @var \GMP */ protected $gmp_x80; /** * @var \GMP */ protected $gmp_xff; /** * @var \GMP */ protected $gmp_x100; /** * @var bool */ protected $is32Bit; /** * Constructor */ public function __construct() { $this->gmp_x00 = gmp_init(0x00); $this->gmp_x7f = gmp_init(0x7f); $this->gmp_x80 = gmp_init(0x80); $this->gmp_xff = gmp_init(0xff); $this->gmp_x100 = gmp_init(0x100); $this->is32Bit = BigEndian::is32Bit(); } /** * {@inheritdoc} */ public function encodeVarint($varint) { $bytes = []; $value = $this->is32Bit ? gmp_and($varint, '0x0ffffffffffffffff') : sprintf('%u', $varint); while (gmp_cmp($value, $this->gmp_x00) > 0) { $bytes[] = gmp_intval(gmp_and($value, $this->gmp_x7f)) | 0x80; $value = gmp_div_q($value, $this->gmp_x80); } return $bytes; } /** * {@inheritdoc} */ public function encodeSFixed64($sFixed64) { $value = $this->is32Bit ? gmp_and($sFixed64, '0x0ffffffffffffffff') : gmp_init(sprintf('%u', $sFixed64)); $bytes = ''; for ($i = 0; $i < 8; ++$i) { $bytes .= chr(gmp_intval(gmp_and($value, $this->gmp_xff))); $value = gmp_div_q($value, $this->gmp_x100); } return $bytes; } } Protobuf/WriteContext.php000066400000002550147735112210011523 0ustar00<?php namespace Protobuf; use Protobuf\Stream; use Protobuf\Configuration; use Protobuf\Binary\StreamWriter; /** * Write context * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class WriteContext { /** * @var \Protobuf\ComputeSizeContext */ private $computeSizeContext; /** * @var \Protobuf\Binary\StreamWriter */ private $writer; /** * @var \Protobuf\Stream */ private $stream; /** * @var integer */ private $length; /** * @param \Protobuf\Stream $stream * @param \Protobuf\Binary\StreamWriter $writer * @param \Protobuf\ComputeSizeContext $computeSizeContext */ public function __construct(Stream $stream, StreamWriter $writer, ComputeSizeContext $computeSizeContext) { $this->stream = $stream; $this->writer = $writer; $this->computeSizeContext = $computeSizeContext; } /** * @return \Protobuf\Binary\StreamWriter */ public function getWriter() { return $this->writer; } /** * @return \Protobuf\Stream */ public function getStream() { return $this->stream; } /** * @return \Protobuf\ComputeSizeContext */ public function getComputeSizeContext() { return $this->computeSizeContext; } } Protobuf/EnumCollection.php000066400000002023147735112210011777 0ustar00<?php namespace Protobuf; use InvalidArgumentException; use ArrayObject; /** * Protobuf enum collection * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class EnumCollection extends ArrayObject implements Collection { /** * @param array<\Protobuf\Enum> $values */ public function __construct(array $values = []) { array_walk($values, [$this, 'add']); } /** * Adds a \Protobuf\Enum to this collection * * @param \Protobuf\Enum $enum */ public function add(Enum $enum) { parent::offsetSet(null, $enum); } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { if ( ! $value instanceof Enum) { throw new InvalidArgumentException(sprintf( 'Argument 2 passed to %s must be a \Protobuf\Enum, %s given', __METHOD__, is_object($value) ? get_class($value) : gettype($value) )); } parent::offsetSet($offset, $value); } } Protobuf/ScalarCollection.php000066400000002423147735112210012304 0ustar00<?php namespace Protobuf; use InvalidArgumentException; use ArrayObject; /** * Scalar collection * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class ScalarCollection extends ArrayObject implements Collection { /** * @param array<scalar> $values */ public function __construct(array $values = []) { array_walk($values, [$this, 'add']); } /** * Adds a value to this collection * * @param scalar $value */ public function add($value) { if ( ! is_scalar($value)) { throw new InvalidArgumentException(sprintf( 'Argument 1 passed to %s must be a scalar value, %s given', __METHOD__, is_object($value) ? get_class($value) : gettype($value) )); } parent::offsetSet(null, $value); } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { if ( ! is_scalar($value)) { throw new InvalidArgumentException(sprintf( 'Argument 2 passed to %s must be a scalar value, %s given', __METHOD__, is_object($value) ? get_class($value) : gettype($value) )); } parent::offsetSet($offset, $value); } } Protobuf/Enum.php000066400000001604147735112210007767 0ustar00<?php namespace Protobuf; use ReflectionClass; use BadMethodCallException; use UnexpectedValueException; /** * Base Enum * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ abstract class Enum { /** * Enum value * * @var integer */ protected $value; /** * Enum name * * @var string */ protected $name; /** * @param string $name * @param integer $value */ public function __construct($name, $value) { $this->name = $name; $this->value = $value; } /** * @return int */ public function value() { return $this->value; } /** * @return string */ public function name() { return $this->name; } /** * @return string */ public function __toString() { return (string) $this->name; } } Protobuf/UnknownFieldSet.php000066400000000720147735112210012140 0ustar00<?php namespace Protobuf; use ArrayObject; /** * Used to keep track of fields which were seen when Unknown value parsing a message * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class UnknownFieldSet extends ArrayObject implements Collection { /** * Adds an element to set. * * @param \Protobuf\Unknown $unknown */ public function add(Unknown $unknown) { $this->offsetSet($unknown->tag, $unknown); } } Protobuf/Stream.php000066400000014523147735112210010322 0ustar00<?php namespace Protobuf; use RuntimeException; use InvalidArgumentException; /** * PHP stream implementation * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class Stream { /** * @var resource */ private $stream; /** * @var integer */ private $size; /** * @param resource $stream * @param integer $size * * @throws \InvalidArgumentException if the stream is not a stream resource */ public function __construct($stream, $size = null) { if ( ! is_resource($stream)) { throw new InvalidArgumentException('Stream must be a resource'); } $this->size = $size; $this->stream = $stream; } /** * Closes the stream when the destructed */ public function __destruct() { if (is_resource($this->stream)) { fclose($this->stream); } $this->stream = null; } /** * {@inheritdoc} */ public function __toString() { return $this->getContents(); } /** * Returns the remaining contents of the stream as a string. * * @return string */ public function getContents() { if ( ! $this->stream) { return ''; } $this->seek(0); return stream_get_contents($this->stream); } /** * Get the size of the stream * * @return int|null Returns the size in bytes if known * * @throws \InvalidArgumentException If cannot find out the stream size */ public function getSize() { if ($this->size !== null) { return $this->size; } if ( ! $this->stream) { return null; } $stats = fstat($this->stream); if (isset($stats['size'])) { return $this->size = $stats['size']; } throw new RuntimeException('Unknown stream size'); } /** * Returns true if the stream is at the end of the stream. * * @return bool */ public function eof() { return feof($this->stream); } /** * Returns the current position of the file read/write pointer * * @return int * * @throws \RuntimeException If cannot find out the stream position */ public function tell() { $position = ftell($this->stream); if ($position === false) { throw new RuntimeException('Unable to get stream position'); } return $position; } /** * Seek to a position in the stream * * @param int $offset * @param int $whence * * @throws \RuntimeException If cannot find out the stream position */ public function seek($offset, $whence = SEEK_SET) { if (fseek($this->stream, $offset, $whence) !== 0) { throw new RuntimeException('Unable to seek stream position to ' . $offset); } } /** * Read data from the stream * * @param int $length * * @return string */ public function read($length) { if ($length < 1) { return ''; } $buffer = fread($this->stream, $length); if ($buffer === false) { throw new RuntimeException('Failed to read ' . $length . ' bytes'); } return $buffer; } /** * Read stream * * @param int $length * * @return \Protobuf\Stream * * @throws \RuntimeException */ public function readStream($length) { $stream = self::fromString(); $target = $stream->stream; $source = $this->stream; if ($length < 1) { return $stream; } $written = stream_copy_to_stream($source, $target, $length); if ($written !== $length) { throw new RuntimeException('Failed to read stream with ' . $length . ' bytes'); } $stream->seek(0); return $stream; } /** * Write data to the stream * * @param string $bytes * @param int $length * * @return int * * @throws \RuntimeException */ public function write($bytes, $length) { $written = fwrite($this->stream, $bytes, $length); if ($written !== $length) { throw new RuntimeException('Failed to write '.$length.' bytes'); } $this->size = null; return $written; } /** * Write stream * * @param \Protobuf\Stream $stream * @param int $length * * @return int * * @throws \RuntimeException */ public function writeStream(Stream $stream, $length) { $target = $this->stream; $source = $stream->stream; $written = stream_copy_to_stream($source, $target); if ($written !== $length) { throw new RuntimeException('Failed to write stream with ' . $length . ' bytes'); } $this->size = null; return $written; } /** * Wrap the input resource in a stream object. * * @param \Protobuf\Stream|resource|string $resource * @param integer $size * * @return \Protobuf\Stream * * @throws \InvalidArgumentException if the $resource arg is not valid. */ public static function wrap($resource = '', $size = null) { if ($resource instanceof Stream) { return $resource; } $type = gettype($resource); if ($type == 'string') { return self::fromString($resource, $size); } if ($type == 'resource') { return new self($resource, $size); } throw new InvalidArgumentException('Invalid resource type: ' . $type); } /** * Create a new stream. * * @return \Protobuf\Stream */ public static function create() { return new self(fopen('php://temp', 'r+')); } /** * Create a new stream from a string. * * @param string $resource * @param integer $size * * @return \Protobuf\Stream */ public static function fromString($resource = '', $size = null) { $stream = fopen('php://temp', 'r+'); if ($resource !== '') { fwrite($stream, $resource); fseek($stream, 0); } return new self($stream, $size); } } Protobuf/WireFormat.php000066400000006436147735112210011152 0ustar00<?php namespace Protobuf; use RuntimeException; /** * This class contains constants and helper functions useful for dealing with * the Protocol Buffer wire format. * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class WireFormat { const WIRE_VARINT = 0; const WIRE_FIXED64 = 1; const WIRE_LENGTH = 2; const WIRE_GROUP_START = 3; const WIRE_GROUP_END = 4; const WIRE_FIXED32 = 5; const WIRE_UNKNOWN = -1; const TAG_TYPE_BITS = 3; const TAG_TYPE_MASK = 0x7; /** * @var array */ private static $wireTypeMap = [ Field::TYPE_INT32 => WireFormat::WIRE_VARINT, Field::TYPE_INT64 => WireFormat::WIRE_VARINT, Field::TYPE_UINT32 => WireFormat::WIRE_VARINT, Field::TYPE_UINT64 => WireFormat::WIRE_VARINT, Field::TYPE_SINT32 => WireFormat::WIRE_VARINT, Field::TYPE_SINT64 => WireFormat::WIRE_VARINT, Field::TYPE_BOOL => WireFormat::WIRE_VARINT, Field::TYPE_ENUM => WireFormat::WIRE_VARINT, Field::TYPE_FIXED64 => WireFormat::WIRE_FIXED64, Field::TYPE_SFIXED64 => WireFormat::WIRE_FIXED64, Field::TYPE_DOUBLE => WireFormat::WIRE_FIXED64, Field::TYPE_STRING => WireFormat::WIRE_LENGTH, Field::TYPE_BYTES => WireFormat::WIRE_LENGTH, Field::TYPE_MESSAGE => WireFormat::WIRE_LENGTH, Field::TYPE_FIXED32 => WireFormat::WIRE_FIXED32, Field::TYPE_SFIXED32 => WireFormat::WIRE_FIXED32, Field::TYPE_FLOAT => WireFormat::WIRE_FIXED32, ]; /** * Given a field type, determines the wire type. * * @param integer $type * @param integer $default * * @return integer */ public static function getWireType($type, $default) { // Unknown types just return the reported wire type return isset(self::$wireTypeMap[$type]) ? self::$wireTypeMap[$type] : $default; } /** * Assert the wire type match * * @param integer $wire * @param integer $type */ public static function assertWireType($wire, $type) { $expected = WireFormat::getWireType($type, $wire); if ($wire !== $expected) { throw new RuntimeException(sprintf( "Expected wire type %s but got %s for type %s.", $expected, $wire, $type )); } } /** * Given a tag value, determines the field number (the upper 29 bits). * * @param integer $tag * * @return integer */ public static function getTagFieldNumber($tag) { return $tag >> self::TAG_TYPE_BITS; } /** * Given a tag value, determines the wire type (the lower 3 bits). * * @param integer $tag * * @return integer */ public static function getTagWireType($tag) { return $tag & self::TAG_TYPE_MASK; } /** * Makes a tag value given a field number and wire type * * @param integer $tag * @param integer $wireType * * @return integer */ public static function getFieldKey($tag, $wireType) { return ($tag << self::TAG_TYPE_BITS) | $wireType; } } Protobuf/Exception.php000066400000000310147735112210011012 0ustar00<?php namespace Protobuf; /** * Base Exception * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class Exception extends \Exception { } Protobuf/Serializer.php000066400000001155147735112210011175 0ustar00<?php namespace Protobuf; /** * Protocol buffer serializer * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ interface Serializer { /** * Serializes the given message. * * @param \Protobuf\Message $message * * @return \Protobuf\Stream */ public function serialize(Message $message); /** * Deserializes the given data to the specified message. * * @param string $class * @param \Protobuf\Stream|resource|string $stream * * @return \Protobuf\Message */ public function unserialize($class, $stream); } Protobuf/Message.php000066400000004042147735112210010446 0ustar00<?php namespace Protobuf; use Protobuf\ComputeSizeContext; use Protobuf\Configuration; use Protobuf\WriteContext; use Protobuf\ReadContext; /** * Base interface implemented by Protocol Message objects * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ interface Message { /** * Creates message from the given stream. * * @param \Protobuf\Stream|resource|string $stream * @param \Protobuf\Configuration $configuration * * @return \Protobuf\Message */ public static function fromStream($stream, Configuration $configuration = null); /** * Serializes the message and returns a stream containing its bytes. * * @param \Protobuf\Configuration $configuration * * @return \Protobuf\Stream */ public function toStream(Configuration $configuration = null); /** * Compute the number of bytes that would be needed to encode the message * * @param \Protobuf\ComputeSizeContext $context * * @return integer */ public function serializedSize(ComputeSizeContext $context); /** * Serializes the message and returns a stream containing its bytes. * * @param \Protobuf\ReadContext $context */ public function readFrom(ReadContext $context); /** * Encodes and writes the message * * @param \Protobuf\ReadContext $context * * @return \Protobuf\Stream */ public function writeTo(WriteContext $context); /** * Merge $context into the message being built. * * @param \Protobuf\Message $message */ public function merge(Message $message); /** * Obtain the list of unknown fields in this message. * * @return \Protobuf\UnknownFieldSet */ public function unknownFieldSet(); /** * Obtain the map of extensions in this message. * * @return \Protobuf\Extension\ExtensionFieldMap */ public function extensions(); /** * Reset all fields back to the initial values. */ public function clear(); } Protobuf/Extension/ExtensionFieldMap.php000066400000005310147735112210014413 0ustar00<?php namespace Protobuf\Extension; use InvalidArgumentException; use OutOfBoundsException; use SplObjectStorage; use Protobuf\Message; use Protobuf\Collection; use Protobuf\WriteContext; use Protobuf\ComputeSizeContext; /** * A table of known extensions values * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class ExtensionFieldMap extends SplObjectStorage implements Collection { /** * @var string */ protected $extendee; /** * @param string $extendee */ public function __construct($extendee = null) { $this->extendee = trim($extendee, '\\'); } /** * @param \Protobuf\Extension\ExtensionField $extension * @param mixed $value */ public function add(ExtensionField $extension, $value) { if ( ! $value instanceof Message) { $this->put($extension, $value); return; } $className = get_class($value); $existing = isset($this[$extension]) ? $this[$extension] : null; if ($existing instanceof $className) { $value->merge($existing); } $this->put($extension, $value); } /** * @param \Protobuf\Extension\ExtensionField $extension * @param mixed $value */ public function put(ExtensionField $extension, $value) { $extendee = trim($extension->getExtendee(), '\\'); if ($extendee !== $this->extendee) { throw new InvalidArgumentException(sprintf( 'Invalid extendee, %s is expected but %s given', $this->extendee, $extendee )); } $this->attach($extension, $value); } /** * @param \Protobuf\Extension\ExtensionField $key * * @return mixed */ public function get(ExtensionField $key) { return $this->offsetGet($key); } /** * @param \Protobuf\ComputeSizeContext $context * * @return integer */ public function serializedSize(ComputeSizeContext $context) { $size = 0; for ($this->rewind(); $this->valid(); $this->next()) { $extension = $this->current(); $value = $this->getInfo(); $size += $extension->serializedSize($context, $value); } return $size; } /** * @param \Protobuf\WriteContext $context */ public function writeTo(WriteContext $context) { for ($this->rewind(); $this->valid(); $this->next()) { $extension = $this->current(); $value = $this->getInfo(); $extension->writeTo($context, $value); } } } Protobuf/Extension/ExtensionField.php000066400000004773147735112210013771 0ustar00<?php namespace Protobuf\Extension; use Protobuf\ReadContext; use Protobuf\WriteContext; use Protobuf\ComputeSizeContext; /** * Protobuf extension field * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class ExtensionField { /** * @var callback */ private $sizeCalculator; /** * @var callback */ private $writer; /** * @var callback */ private $reader; /** * @var string */ private $extendee; /** * @var string */ private $method; /** * @var string */ private $name; /** * @var integer */ private $tag; /** * @param string $extendee * @param string $name * @param integer $tag * @param callback $reader * @param callback $writer * @param callback $sizeCalculator * @param string $method */ public function __construct($extendee, $name, $tag, $reader, $writer, $sizeCalculator, $method = null) { $this->tag = $tag; $this->name = $name; $this->reader = $reader; $this->writer = $writer; $this->method = $method; $this->extendee = $extendee; $this->sizeCalculator = $sizeCalculator; } /** * @return string */ public function getExtendee() { return $this->extendee; } /** * @return string */ public function getMethod() { return $this->method; } /** * @return string */ public function getName() { return $this->name; } /** * @return integer */ public function getTag() { return $this->tag; } /** * @param \Protobuf\ComputeSizeContext $context * @param mixed $value * * @return integer */ public function serializedSize(ComputeSizeContext $context, $value) { return call_user_func($this->sizeCalculator, $context, $value); } /** * @param \Protobuf\WriteContext $context * @param mixed $value */ public function writeTo(WriteContext $context, $value) { call_user_func($this->writer, $context, $value); } /** * @param \Protobuf\ReadContext $context * @param integer $wire * * @return mixed */ public function readFrom(ReadContext $context, $wire) { return call_user_func($this->reader, $context, $wire); } } Protobuf/Extension/ExtensionRegistry.php000066400000002450147735112210014544 0ustar00<?php namespace Protobuf\Extension; /** * A table of known extensions indexed by extendee and field number * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class ExtensionRegistry { /** * @var array */ protected $extensions = []; /** * Remove all registered extensions */ public function clear() { $this->extensions = []; } /** * Adds an element to the registry. * * @param \Protobuf\Extension\ExtensionField $extension */ public function add(ExtensionField $extension) { $extendee = trim($extension->getExtendee(), '\\'); $number = $extension->getTag(); if ( ! isset($this->extensions[$extendee])) { $this->extensions[$extendee] = []; } $this->extensions[$extendee][$number] = $extension; } /** * Find an extension by containing field number * * @param string $className * @param integer $number * * @return \Protobuf\Extension\ExtensionField|null */ public function findByNumber($className, $number) { $extendee = trim($className, '\\'); if ( ! isset($this->extensions[$extendee][$number])) { return null; } return $this->extensions[$extendee][$number]; } } Protobuf/ReadContext.php000066400000003441147735112210011304 0ustar00<?php namespace Protobuf; use Protobuf\Stream; use Protobuf\Binary\StreamReader; use Protobuf\Extension\ExtensionRegistry; /** * Read context * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class ReadContext { /** * @var \Protobuf\Extension\ExtensionRegistry */ private $extensionRegistry; /** * @var \Protobuf\Binary\StreamReader */ private $reader; /** * @var \Protobuf\Stream */ private $stream; /** * @var integer */ private $length; /** * @param \Protobuf\Stream|resource|string $stream * @param \Protobuf\Binary\StreamReader $reader * @param \Protobuf\Extension\ExtensionRegistry $extensionRegistry */ public function __construct($stream, StreamReader $reader, ExtensionRegistry $extensionRegistry = null) { if ( ! $stream instanceof \Protobuf\Stream) { $stream = Stream::wrap($stream); } $this->stream = $stream; $this->reader = $reader; $this->extensionRegistry = $extensionRegistry; } /** * Return a ExtensionRegistry. * * @return \Protobuf\Extension\ExtensionRegistry */ public function getExtensionRegistry() { return $this->extensionRegistry; } /** * @return \Protobuf\Binary\StreamReader */ public function getReader() { return $this->reader; } /** * @return \Protobuf\Stream */ public function getStream() { return $this->stream; } /** * @return integer */ public function getLength() { return $this->length; } /** * @param integer $length */ public function setLength($length) { $this->length = $length; } } Protobuf/ComputeSizeContext.php000066400000001136147735112210012677 0ustar00<?php namespace Protobuf; use Protobuf\Binary\SizeCalculator; /** * Compute Size Context * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class ComputeSizeContext { /** * @var \Protobuf\Binary\SizeCalculator */ private $calculator; /** * @param \Protobuf\Binary\SizeCalculator $calculator */ public function __construct(SizeCalculator $calculator) { $this->calculator = $calculator; } /** * @return \Protobuf\Binary\SizeCalculator */ public function getSizeCalculator() { return $this->calculator; } } Protobuf/Extension.php000066400000000351147735112210011035 0ustar00<?php namespace Protobuf; use Protobuf\ReadContext; use Protobuf\WriteContext; use Protobuf\ComputeSizeContext; /** * Protobuf extension field * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ interface Extension { } Protobuf/MessageSerializer.php000066400000002266147735112210012506 0ustar00<?php namespace Protobuf; /** * Default protocol buffers serializer implementation * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class MessageSerializer implements Serializer { /** * @var \Protobuf\Configuration */ private $config; /** * @param \Protobuf\Configuration $config */ public function __construct(Configuration $config = null) { $this->config = $config ?: Configuration::getInstance(); } /** * @return \Protobuf\Configuration */ public function getConfiguration() { return $this->config; } /** * Serializes the given message. * * @param \Protobuf\Message $message * * @return \Protobuf\Stream */ public function serialize(Message $message) { return $message->toStream($this->config); } /** * Deserializes the given data to the specified message. * * @param string $class * @param \Protobuf\Stream|resource|string $stream * * @return \Protobuf\Message */ public function unserialize($class, $stream) { return new $class($stream, $this->config); } } Protobuf/Configuration.php000066400000010512147735112210011670 0ustar00<?php namespace Protobuf; use Protobuf\Binary\Platform\PlatformFactory; use Protobuf\Extension\ExtensionRegistry; use Protobuf\Binary\SizeCalculator; use Protobuf\Binary\StreamWriter; use Protobuf\Binary\StreamReader; /** * Base configuration class for the protobuf * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class Configuration { /** * @var \Protobuf\Extension\ExtensionRegistry */ private $extensionRegistry; /** * @var \Protobuf\Binary\Platform\PlatformFactory */ private $platformFactory; /** * @var \Protobuf\Binary\StreamWriter */ private $streamWriter; /** * @var \Protobuf\Binary\StreamReader */ private $streamReader; /** * @var \Protobuf\Binary\SizeCalculator */ private $sizeCalculator; /** * @var \Protobuf\DescriptorLoader */ protected static $instance; /** * Return a ExtensionRegistry. * * @return \Protobuf\Extension\ExtensionRegistry */ public function getExtensionRegistry() { if ($this->extensionRegistry === null) { $this->extensionRegistry = new ExtensionRegistry(); } return $this->extensionRegistry; } /** * Set a ExtensionRegistry. * * @param \Protobuf\Extension\ExtensionRegistry $extensionRegistry */ public function setExtensionRegistry(ExtensionRegistry $extensionRegistry) { $this->extensionRegistry = $extensionRegistry; } /** * Return a PlatformFactory. * * @return \Protobuf\Binary\Platform\PlatformFactory */ public function getPlatformFactory() { if ($this->platformFactory !== null) { return $this->platformFactory; } return $this->platformFactory = new PlatformFactory(); } /** * Return a StreamReader * * @return \Protobuf\Binary\StreamReader */ public function getStreamReader() { if ($this->streamReader !== null) { return $this->streamReader; } return $this->streamReader = new StreamReader($this); } /** * Return a StreamWriter * * @return \Protobuf\Binary\StreamWriter */ public function getStreamWriter() { if ($this->streamWriter !== null) { return $this->streamWriter; } return $this->streamWriter = new StreamWriter($this); } /** * Return a SizeCalculator * * @return \Protobuf\Binary\SizeCalculator */ public function getSizeCalculator() { if ($this->sizeCalculator !== null) { return $this->sizeCalculator; } return $this->sizeCalculator = new SizeCalculator($this); } /** * Sets the PlatformFactory. * * @param \Protobuf\Binary\Platform\PlatformFactory $platformFactory */ public function setPlatformFactory(PlatformFactory $platformFactory) { $this->platformFactory = $platformFactory; } /** * Create a compute size context. * * @return \Protobuf\ComputeSizeContext */ public function createComputeSizeContext() { $calculator = $this->getSizeCalculator(); $context = new ComputeSizeContext($calculator); return $context; } /** * Create a write context. * * @return \Protobuf\WriteContext */ public function createWriteContext() { $stream = Stream::create(); $writer = $this->getStreamWriter(); $sizeContext = $this->createComputeSizeContext(); $context = new WriteContext($stream, $writer, $sizeContext); return $context; } /** * Create a read context. * * @param \Protobuf\Stream|resource|string $stream * * @return \Protobuf\ReadContext */ public function createReadContext($stream) { $reader = $this->getStreamReader(); $registry = $this->extensionRegistry; $context = new ReadContext($stream, $reader, $registry); return $context; } /** * Returns single instance of this class * * @return \Protobuf\Configuration */ public static function getInstance() { if (self::$instance !== null) { return self::$instance; } return self::$instance = new Configuration(); } } Protobuf/Field.php000066400000006413147735112210010111 0ustar00<?php namespace Protobuf; /** * Protobuf field label (optional, required, repeated) and types * * @author Iván Montes <drslump@pollinimini.net> * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class Field { const LABEL_OPTIONAL = 1; const LABEL_REQUIRED = 2; const LABEL_REPEATED = 3; const LABEL_UNKNOWN = -1; const TYPE_DOUBLE = 1; const TYPE_FLOAT = 2; const TYPE_INT64 = 3; const TYPE_UINT64 = 4; const TYPE_INT32 = 5; const TYPE_FIXED64 = 6; const TYPE_FIXED32 = 7; const TYPE_BOOL = 8; const TYPE_STRING = 9; const TYPE_GROUP = 10; const TYPE_MESSAGE = 11; const TYPE_BYTES = 12; const TYPE_UINT32 = 13; const TYPE_ENUM = 14; const TYPE_SFIXED32 = 15; const TYPE_SFIXED64 = 16; const TYPE_SINT32 = 17; const TYPE_SINT64 = 18; const TYPE_UNKNOWN = -1; /** * @var array */ protected static $names = [ self::TYPE_DOUBLE => 'double', self::TYPE_FLOAT => 'float', self::TYPE_INT64 => 'int64', self::TYPE_UINT64 => 'uint64', self::TYPE_INT32 => 'int32', self::TYPE_FIXED64 => 'fixed64', self::TYPE_FIXED32 => 'fixed32', self::TYPE_BOOL => 'bool', self::TYPE_STRING => 'string', self::TYPE_MESSAGE => 'message', self::TYPE_BYTES => 'bytes', self::TYPE_UINT32 => 'uint32', self::TYPE_ENUM => 'enum', self::TYPE_SFIXED32 => 'sfixed32', self::TYPE_SFIXED64 => 'sfixed64', self::TYPE_SINT32 => 'sint32', self::TYPE_SINT64 => 'sint64', ]; /** * Obtain the label name (repeated, optional, required). * * @param string $label * * @return string */ public static function getLabelName($label) { if ($label === self::LABEL_OPTIONAL) { return 'optional'; } if ($label === self::LABEL_REQUIRED) { return 'required'; } if ($label === self::LABEL_REPEATED) { return 'repeated'; } return null; } /** * @param integer $type * * @return string */ public static function getTypeName($type) { return isset(self::$names[$type]) ? self::$names[$type] : null; } /** * @param integer $type * * @return string */ public static function getPhpType($type) { switch ($type) { case self::TYPE_DOUBLE: case self::TYPE_FLOAT: return 'float'; case self::TYPE_INT64: case self::TYPE_UINT64: case self::TYPE_INT32: case self::TYPE_FIXED64: case self::TYPE_FIXED32: case self::TYPE_UINT32: case self::TYPE_SFIXED32: case self::TYPE_SFIXED64: case self::TYPE_SINT32: case self::TYPE_SINT64: return 'int'; case self::TYPE_BOOL: return 'bool'; case self::TYPE_STRING: return 'string'; case self::TYPE_BYTES: return '\Protobuf\Stream'; default: return null; } } } Protobuf/AbstractMessage.php000066400000002043147735112210012131 0ustar00<?php namespace Protobuf; use Protobuf\TextFormat; /** * Abstract message class * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ abstract class AbstractMessage implements Message { /** * Message constructor * * @param \Protobuf\Stream|resource|string $stream * @param \Protobuf\Configuration $configuration */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { if ($stream === null) { return; } $config = $configuration ?: \Protobuf\Configuration::getInstance(); $context = $config->createReadContext($stream); $this->readFrom($context); } /** * {@inheritdoc} */ public function __toString() { $format = new TextFormat(); $stream = $format->encodeMessage($this); return $stream->__toString(); } /** * {@inheritdoc} */ public static function __set_state(array $values) { return static::fromArray($values); } } Protobuf/StreamCollection.php000066400000002051147735112210012327 0ustar00<?php namespace Protobuf; use InvalidArgumentException; use ArrayObject; /** * Protobuf Stream collection * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class StreamCollection extends ArrayObject implements Collection { /** * @param array<\Protobuf\Stream> $values */ public function __construct(array $values = []) { array_walk($values, [$this, 'add']); } /** * Adds a \Protobuf\Stream to this collection * * @param \Protobuf\Stream $stream */ public function add(Stream $stream) { parent::offsetSet(null, $stream); } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { if ( ! $value instanceof Stream) { throw new InvalidArgumentException(sprintf( 'Argument 2 passed to %s must be a \Protobuf\Stream, %s given', __METHOD__, is_object($value) ? get_class($value) : gettype($value) )); } parent::offsetSet($offset, $value); } } Protobuf/MessageCollection.php000066400000002060147735112210012460 0ustar00<?php namespace Protobuf; use InvalidArgumentException; use ArrayObject; /** * Message collection * * @author Fabio B. Silva <fabio.bat.silva@gmail.com> */ class MessageCollection extends ArrayObject implements Collection { /** * @param array<\Protobuf\Message> $values */ public function __construct(array $values = []) { array_walk($values, [$this, 'add']); } /** * Adds a message to this collection * * @param \Protobuf\Message $message */ public function add(Message $message) { parent::offsetSet(null, $message); } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { if ( ! $value instanceof Message) { throw new InvalidArgumentException(sprintf( 'Argument 2 passed to %s must implement interface \Protobuf\Message, %s given', __METHOD__, is_object($value) ? get_class($value) : gettype($value) )); } parent::offsetSet($offset, $value); } } Google/Protobuf/MessageOptions.php000066400000036542147735112210013250 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.MessageOptions */ class MessageOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * message_set_wire_format optional bool = 1 * * @var bool */ protected $message_set_wire_format = null; /** * no_standard_descriptor_accessor optional bool = 2 * * @var bool */ protected $no_standard_descriptor_accessor = null; /** * deprecated optional bool = 3 * * @var bool */ protected $deprecated = null; /** * map_entry optional bool = 7 * * @var bool */ protected $map_entry = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->message_set_wire_format = false; $this->no_standard_descriptor_accessor = false; $this->deprecated = false; parent::__construct($stream, $configuration); } /** * Check if 'message_set_wire_format' has a value * * @return bool */ public function hasMessageSetWireFormat() { return $this->message_set_wire_format !== null; } /** * Get 'message_set_wire_format' value * * @return bool */ public function getMessageSetWireFormat() { return $this->message_set_wire_format; } /** * Set 'message_set_wire_format' value * * @param bool $value */ public function setMessageSetWireFormat($value = null) { $this->message_set_wire_format = $value; } /** * Check if 'no_standard_descriptor_accessor' has a value * * @return bool */ public function hasNoStandardDescriptorAccessor() { return $this->no_standard_descriptor_accessor !== null; } /** * Get 'no_standard_descriptor_accessor' value * * @return bool */ public function getNoStandardDescriptorAccessor() { return $this->no_standard_descriptor_accessor; } /** * Set 'no_standard_descriptor_accessor' value * * @param bool $value */ public function setNoStandardDescriptorAccessor($value = null) { $this->no_standard_descriptor_accessor = $value; } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'map_entry' has a value * * @return bool */ public function hasMapEntry() { return $this->map_entry !== null; } /** * Get 'map_entry' value * * @return bool */ public function getMapEntry() { return $this->map_entry; } /** * Set 'map_entry' value * * @param bool $value */ public function setMapEntry($value = null) { $this->map_entry = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'message_set_wire_format' => false, 'no_standard_descriptor_accessor' => false, 'deprecated' => false, 'map_entry' => null, 'uninterpreted_option' => [] ], $values); $message->setMessageSetWireFormat($values['message_set_wire_format']); $message->setNoStandardDescriptorAccessor($values['no_standard_descriptor_accessor']); $message->setDeprecated($values['deprecated']); $message->setMapEntry($values['map_entry']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'MessageOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'message_set_wire_format', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'no_standard_descriptor_accessor', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 7, 'name' => 'map_entry', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->message_set_wire_format !== null) { $writer->writeVarint($stream, 8); $writer->writeBool($stream, $this->message_set_wire_format); } if ($this->no_standard_descriptor_accessor !== null) { $writer->writeVarint($stream, 16); $writer->writeBool($stream, $this->no_standard_descriptor_accessor); } if ($this->deprecated !== null) { $writer->writeVarint($stream, 24); $writer->writeBool($stream, $this->deprecated); } if ($this->map_entry !== null) { $writer->writeVarint($stream, 56); $writer->writeBool($stream, $this->map_entry); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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, 8); $this->message_set_wire_format = $reader->readBool($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->no_standard_descriptor_accessor = $reader->readBool($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 7) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->map_entry = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->message_set_wire_format !== null) { $size += 1; $size += 1; } if ($this->no_standard_descriptor_accessor !== null) { $size += 1; $size += 1; } if ($this->deprecated !== null) { $size += 1; $size += 1; } if ($this->map_entry !== null) { $size += 1; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->message_set_wire_format = false; $this->no_standard_descriptor_accessor = false; $this->deprecated = false; $this->map_entry = null; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\MessageOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->message_set_wire_format = ($message->message_set_wire_format !== null) ? $message->message_set_wire_format : $this->message_set_wire_format; $this->no_standard_descriptor_accessor = ($message->no_standard_descriptor_accessor !== null) ? $message->no_standard_descriptor_accessor : $this->no_standard_descriptor_accessor; $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->map_entry = ($message->map_entry !== null) ? $message->map_entry : $this->map_entry; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/SourceCodeInfo/Location.php000066400000040255147735112210014723 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\SourceCodeInfo; /** * Protobuf message : google.protobuf.SourceCodeInfo.Location */ class Location extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * path repeated int32 = 1 * * @var \Protobuf\Collection */ protected $path = null; /** * span repeated int32 = 2 * * @var \Protobuf\Collection */ protected $span = null; /** * leading_comments optional string = 3 * * @var string */ protected $leading_comments = null; /** * trailing_comments optional string = 4 * * @var string */ protected $trailing_comments = null; /** * leading_detached_comments repeated string = 6 * * @var \Protobuf\Collection */ protected $leading_detached_comments = null; /** * Check if 'path' has a value * * @return bool */ public function hasPathList() { return $this->path !== null; } /** * Get 'path' value * * @return \Protobuf\Collection */ public function getPathList() { return $this->path; } /** * Set 'path' value * * @param \Protobuf\Collection $value */ public function setPathList(\Protobuf\Collection $value = null) { $this->path = $value; } /** * Add a new element to 'path' * * @param int $value */ public function addPath($value) { if ($this->path === null) { $this->path = new \Protobuf\ScalarCollection(); } $this->path->add($value); } /** * Check if 'span' has a value * * @return bool */ public function hasSpanList() { return $this->span !== null; } /** * Get 'span' value * * @return \Protobuf\Collection */ public function getSpanList() { return $this->span; } /** * Set 'span' value * * @param \Protobuf\Collection $value */ public function setSpanList(\Protobuf\Collection $value = null) { $this->span = $value; } /** * Add a new element to 'span' * * @param int $value */ public function addSpan($value) { if ($this->span === null) { $this->span = new \Protobuf\ScalarCollection(); } $this->span->add($value); } /** * Check if 'leading_comments' has a value * * @return bool */ public function hasLeadingComments() { return $this->leading_comments !== null; } /** * Get 'leading_comments' value * * @return string */ public function getLeadingComments() { return $this->leading_comments; } /** * Set 'leading_comments' value * * @param string $value */ public function setLeadingComments($value = null) { $this->leading_comments = $value; } /** * Check if 'trailing_comments' has a value * * @return bool */ public function hasTrailingComments() { return $this->trailing_comments !== null; } /** * Get 'trailing_comments' value * * @return string */ public function getTrailingComments() { return $this->trailing_comments; } /** * Set 'trailing_comments' value * * @param string $value */ public function setTrailingComments($value = null) { $this->trailing_comments = $value; } /** * Check if 'leading_detached_comments' has a value * * @return bool */ public function hasLeadingDetachedCommentsList() { return $this->leading_detached_comments !== null; } /** * Get 'leading_detached_comments' value * * @return \Protobuf\Collection */ public function getLeadingDetachedCommentsList() { return $this->leading_detached_comments; } /** * Set 'leading_detached_comments' value * * @param \Protobuf\Collection $value */ public function setLeadingDetachedCommentsList(\Protobuf\Collection $value = null) { $this->leading_detached_comments = $value; } /** * Add a new element to 'leading_detached_comments' * * @param string $value */ public function addLeadingDetachedComments($value) { if ($this->leading_detached_comments === null) { $this->leading_detached_comments = new \Protobuf\ScalarCollection(); } $this->leading_detached_comments->add($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([ 'path' => [], 'span' => [], 'leading_comments' => null, 'trailing_comments' => null, 'leading_detached_comments' => [] ], $values); $message->setLeadingComments($values['leading_comments']); $message->setTrailingComments($values['trailing_comments']); foreach ($values['path'] as $item) { $message->addPath($item); } foreach ($values['span'] as $item) { $message->addSpan($item); } foreach ($values['leading_detached_comments'] as $item) { $message->addLeadingDetachedComments($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'Location', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'path', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'span', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'leading_comments', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 4, 'name' => 'trailing_comments', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'leading_detached_comments', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), ], ]); } /** * {@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->path !== null) { $innerSize = 0; $calculator = $sizeContext->getSizeCalculator(); foreach ($this->path as $val) { $innerSize += $calculator->computeVarintSize($val); } $writer->writeVarint($stream, 10); $writer->writeVarint($stream, $innerSize); foreach ($this->path as $val) { $writer->writeVarint($stream, $val); } } if ($this->span !== null) { $innerSize = 0; $calculator = $sizeContext->getSizeCalculator(); foreach ($this->span as $val) { $innerSize += $calculator->computeVarintSize($val); } $writer->writeVarint($stream, 18); $writer->writeVarint($stream, $innerSize); foreach ($this->span as $val) { $writer->writeVarint($stream, $val); } } if ($this->leading_comments !== null) { $writer->writeVarint($stream, 26); $writer->writeString($stream, $this->leading_comments); } if ($this->trailing_comments !== null) { $writer->writeVarint($stream, 34); $writer->writeString($stream, $this->trailing_comments); } if ($this->leading_detached_comments !== null) { foreach ($this->leading_detached_comments as $val) { $writer->writeVarint($stream, 50); $writer->writeString($stream, $val); } } 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) { $innerSize = $reader->readVarint($stream); $innerLimit = $stream->tell() + $innerSize; if ($this->path === null) { $this->path = new \Protobuf\ScalarCollection(); } while ($stream->tell() < $innerLimit) { $this->path->add($reader->readVarint($stream)); } continue; } if ($tag === 2) { $innerSize = $reader->readVarint($stream); $innerLimit = $stream->tell() + $innerSize; if ($this->span === null) { $this->span = new \Protobuf\ScalarCollection(); } while ($stream->tell() < $innerLimit) { $this->span->add($reader->readVarint($stream)); } continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->leading_comments = $reader->readString($stream); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->trailing_comments = $reader->readString($stream); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 9); if ($this->leading_detached_comments === null) { $this->leading_detached_comments = new \Protobuf\ScalarCollection(); } $this->leading_detached_comments->add($reader->readString($stream)); 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->path !== null) { $innerSize = 0; foreach ($this->path as $val) { $innerSize += $calculator->computeVarintSize($val); } $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->span !== null) { $innerSize = 0; foreach ($this->span as $val) { $innerSize += $calculator->computeVarintSize($val); } $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->leading_comments !== null) { $size += 1; $size += $calculator->computeStringSize($this->leading_comments); } if ($this->trailing_comments !== null) { $size += 1; $size += $calculator->computeStringSize($this->trailing_comments); } if ($this->leading_detached_comments !== null) { foreach ($this->leading_detached_comments as $val) { $size += 1; $size += $calculator->computeStringSize($val); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->path = null; $this->span = null; $this->leading_comments = null; $this->trailing_comments = null; $this->leading_detached_comments = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\SourceCodeInfo\Location) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->path = ($message->path !== null) ? $message->path : $this->path; $this->span = ($message->span !== null) ? $message->span : $this->span; $this->leading_comments = ($message->leading_comments !== null) ? $message->leading_comments : $this->leading_comments; $this->trailing_comments = ($message->trailing_comments !== null) ? $message->trailing_comments : $this->trailing_comments; $this->leading_detached_comments = ($message->leading_detached_comments !== null) ? $message->leading_detached_comments : $this->leading_detached_comments; } } Google/Protobuf/UninterpretedOption.php000066400000044206147735112210014325 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.UninterpretedOption */ class UninterpretedOption extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name repeated message = 2 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption\NamePart> */ protected $name = null; /** * identifier_value optional string = 3 * * @var string */ protected $identifier_value = null; /** * positive_int_value optional uint64 = 4 * * @var int */ protected $positive_int_value = null; /** * negative_int_value optional int64 = 5 * * @var int */ protected $negative_int_value = null; /** * double_value optional double = 6 * * @var float */ protected $double_value = null; /** * string_value optional bytes = 7 * * @var \Protobuf\Stream */ protected $string_value = null; /** * aggregate_value optional string = 8 * * @var string */ protected $aggregate_value = null; /** * Check if 'name' has a value * * @return bool */ public function hasNameList() { return $this->name !== null; } /** * Get 'name' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption\NamePart> */ public function getNameList() { return $this->name; } /** * Set 'name' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption\NamePart> $value */ public function setNameList(\Protobuf\Collection $value = null) { $this->name = $value; } /** * Add a new element to 'name' * * @param \google\protobuf\UninterpretedOption\NamePart $value */ public function addName(\google\protobuf\UninterpretedOption\NamePart $value) { if ($this->name === null) { $this->name = new \Protobuf\MessageCollection(); } $this->name->add($value); } /** * Check if 'identifier_value' has a value * * @return bool */ public function hasIdentifierValue() { return $this->identifier_value !== null; } /** * Get 'identifier_value' value * * @return string */ public function getIdentifierValue() { return $this->identifier_value; } /** * Set 'identifier_value' value * * @param string $value */ public function setIdentifierValue($value = null) { $this->identifier_value = $value; } /** * Check if 'positive_int_value' has a value * * @return bool */ public function hasPositiveIntValue() { return $this->positive_int_value !== null; } /** * Get 'positive_int_value' value * * @return int */ public function getPositiveIntValue() { return $this->positive_int_value; } /** * Set 'positive_int_value' value * * @param int $value */ public function setPositiveIntValue($value = null) { $this->positive_int_value = $value; } /** * Check if 'negative_int_value' has a value * * @return bool */ public function hasNegativeIntValue() { return $this->negative_int_value !== null; } /** * Get 'negative_int_value' value * * @return int */ public function getNegativeIntValue() { return $this->negative_int_value; } /** * Set 'negative_int_value' value * * @param int $value */ public function setNegativeIntValue($value = null) { $this->negative_int_value = $value; } /** * Check if 'double_value' has a value * * @return bool */ public function hasDoubleValue() { return $this->double_value !== null; } /** * Get 'double_value' value * * @return float */ public function getDoubleValue() { return $this->double_value; } /** * Set 'double_value' value * * @param float $value */ public function setDoubleValue($value = null) { $this->double_value = $value; } /** * Check if 'string_value' has a value * * @return bool */ public function hasStringValue() { return $this->string_value !== null; } /** * Get 'string_value' value * * @return \Protobuf\Stream */ public function getStringValue() { return $this->string_value; } /** * Set 'string_value' value * * @param \Protobuf\Stream $value */ public function setStringValue($value = null) { if ($value !== null && ! $value instanceof \Protobuf\Stream) { $value = \Protobuf\Stream::wrap($value); } $this->string_value = $value; } /** * Check if 'aggregate_value' has a value * * @return bool */ public function hasAggregateValue() { return $this->aggregate_value !== null; } /** * Get 'aggregate_value' value * * @return string */ public function getAggregateValue() { return $this->aggregate_value; } /** * Set 'aggregate_value' value * * @param string $value */ public function setAggregateValue($value = null) { $this->aggregate_value = $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([ 'name' => [], 'identifier_value' => null, 'positive_int_value' => null, 'negative_int_value' => null, 'double_value' => null, 'string_value' => null, 'aggregate_value' => null ], $values); $message->setIdentifierValue($values['identifier_value']); $message->setPositiveIntValue($values['positive_int_value']); $message->setNegativeIntValue($values['negative_int_value']); $message->setDoubleValue($values['double_value']); $message->setStringValue($values['string_value']); $message->setAggregateValue($values['aggregate_value']); foreach ($values['name'] as $item) { $message->addName($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'UninterpretedOption', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption.NamePart' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'identifier_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 4, 'name' => 'positive_int_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_UINT64(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 5, 'name' => 'negative_int_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT64(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'double_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_DOUBLE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 7, 'name' => 'string_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 8, 'name' => 'aggregate_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), ], ]); } /** * {@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->name !== null) { foreach ($this->name as $val) { $writer->writeVarint($stream, 18); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->identifier_value !== null) { $writer->writeVarint($stream, 26); $writer->writeString($stream, $this->identifier_value); } if ($this->positive_int_value !== null) { $writer->writeVarint($stream, 32); $writer->writeVarint($stream, $this->positive_int_value); } if ($this->negative_int_value !== null) { $writer->writeVarint($stream, 40); $writer->writeVarint($stream, $this->negative_int_value); } if ($this->double_value !== null) { $writer->writeVarint($stream, 49); $writer->writeDouble($stream, $this->double_value); } if ($this->string_value !== null) { $writer->writeVarint($stream, 58); $writer->writeByteStream($stream, $this->string_value); } if ($this->aggregate_value !== null) { $writer->writeVarint($stream, 66); $writer->writeString($stream, $this->aggregate_value); } 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 === 2) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption\NamePart(); if ($this->name === null) { $this->name = new \Protobuf\MessageCollection(); } $this->name->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->identifier_value = $reader->readString($stream); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 4); $this->positive_int_value = $reader->readVarint($stream); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 3); $this->negative_int_value = $reader->readVarint($stream); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 1); $this->double_value = $reader->readDouble($stream); continue; } if ($tag === 7) { \Protobuf\WireFormat::assertWireType($wire, 12); $this->string_value = $reader->readByteStream($stream); continue; } if ($tag === 8) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->aggregate_value = $reader->readString($stream); 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->name !== null) { foreach ($this->name as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->identifier_value !== null) { $size += 1; $size += $calculator->computeStringSize($this->identifier_value); } if ($this->positive_int_value !== null) { $size += 1; $size += $calculator->computeVarintSize($this->positive_int_value); } if ($this->negative_int_value !== null) { $size += 1; $size += $calculator->computeVarintSize($this->negative_int_value); } if ($this->double_value !== null) { $size += 1; $size += 8; } if ($this->string_value !== null) { $size += 1; $size += $calculator->computeByteStreamSize($this->string_value); } if ($this->aggregate_value !== null) { $size += 1; $size += $calculator->computeStringSize($this->aggregate_value); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name = null; $this->identifier_value = null; $this->positive_int_value = null; $this->negative_int_value = null; $this->double_value = null; $this->string_value = null; $this->aggregate_value = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\UninterpretedOption) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->identifier_value = ($message->identifier_value !== null) ? $message->identifier_value : $this->identifier_value; $this->positive_int_value = ($message->positive_int_value !== null) ? $message->positive_int_value : $this->positive_int_value; $this->negative_int_value = ($message->negative_int_value !== null) ? $message->negative_int_value : $this->negative_int_value; $this->double_value = ($message->double_value !== null) ? $message->double_value : $this->double_value; $this->string_value = ($message->string_value !== null) ? $message->string_value : $this->string_value; $this->aggregate_value = ($message->aggregate_value !== null) ? $message->aggregate_value : $this->aggregate_value; } } Google/Protobuf/EnumDescriptorProto.php000066400000025735147735112210014301 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.EnumDescriptorProto */ class EnumDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * value repeated message = 2 * * @var \Protobuf\Collection<\google\protobuf\EnumValueDescriptorProto> */ protected $value = null; /** * options optional message = 3 * * @var \google\protobuf\EnumOptions */ protected $options = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'value' has a value * * @return bool */ public function hasValueList() { return $this->value !== null; } /** * Get 'value' value * * @return \Protobuf\Collection<\google\protobuf\EnumValueDescriptorProto> */ public function getValueList() { return $this->value; } /** * Set 'value' value * * @param \Protobuf\Collection<\google\protobuf\EnumValueDescriptorProto> $value */ public function setValueList(\Protobuf\Collection $value = null) { $this->value = $value; } /** * Add a new element to 'value' * * @param \google\protobuf\EnumValueDescriptorProto $value */ public function addValue(\google\protobuf\EnumValueDescriptorProto $value) { if ($this->value === null) { $this->value = new \Protobuf\MessageCollection(); } $this->value->add($value); } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\EnumOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\EnumOptions $value */ public function setOptions(\google\protobuf\EnumOptions $value = null) { $this->options = $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([ 'name' => null, 'value' => [], 'options' => null ], $values); $message->setName($values['name']); $message->setOptions($values['options']); foreach ($values['value'] as $item) { $message->addValue($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'EnumDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.EnumValueDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.EnumOptions' ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->value !== null) { foreach ($this->value as $val) { $writer->writeVarint($stream, 18); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->options !== null) { $writer->writeVarint($stream, 26); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\EnumValueDescriptorProto(); if ($this->value === null) { $this->value = new \Protobuf\MessageCollection(); } $this->value->add($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 \google\protobuf\EnumOptions(); $this->options = $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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->value !== null) { foreach ($this->value as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->options !== null) { $innerSize = $this->options->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->name = null; $this->value = null; $this->options = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\EnumDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->value = ($message->value !== null) ? $message->value : $this->value; $this->options = ($message->options !== null) ? $message->options : $this->options; } } Google/Protobuf/MethodOptions.php000066400000023067147735112210013102 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.MethodOptions */ class MethodOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * deprecated optional bool = 33 * * @var bool */ protected $deprecated = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->deprecated = false; parent::__construct($stream, $configuration); } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'deprecated' => false, 'uninterpreted_option' => [] ], $values); $message->setDeprecated($values['deprecated']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'MethodOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 33, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->deprecated !== null) { $writer->writeVarint($stream, 264); $writer->writeBool($stream, $this->deprecated); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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 === 33) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->deprecated !== null) { $size += 2; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->deprecated = false; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\MethodOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/ServiceDescriptorProto.php000066400000026006147735112210014765 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.ServiceDescriptorProto */ class ServiceDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * method repeated message = 2 * * @var \Protobuf\Collection<\google\protobuf\MethodDescriptorProto> */ protected $method = null; /** * options optional message = 3 * * @var \google\protobuf\ServiceOptions */ protected $options = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'method' has a value * * @return bool */ public function hasMethodList() { return $this->method !== null; } /** * Get 'method' value * * @return \Protobuf\Collection<\google\protobuf\MethodDescriptorProto> */ public function getMethodList() { return $this->method; } /** * Set 'method' value * * @param \Protobuf\Collection<\google\protobuf\MethodDescriptorProto> $value */ public function setMethodList(\Protobuf\Collection $value = null) { $this->method = $value; } /** * Add a new element to 'method' * * @param \google\protobuf\MethodDescriptorProto $value */ public function addMethod(\google\protobuf\MethodDescriptorProto $value) { if ($this->method === null) { $this->method = new \Protobuf\MessageCollection(); } $this->method->add($value); } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\ServiceOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\ServiceOptions $value */ public function setOptions(\google\protobuf\ServiceOptions $value = null) { $this->options = $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([ 'name' => null, 'method' => [], 'options' => null ], $values); $message->setName($values['name']); $message->setOptions($values['options']); foreach ($values['method'] as $item) { $message->addMethod($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'ServiceDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'method', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.MethodDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.ServiceOptions' ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->method !== null) { foreach ($this->method as $val) { $writer->writeVarint($stream, 18); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->options !== null) { $writer->writeVarint($stream, 26); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\MethodDescriptorProto(); if ($this->method === null) { $this->method = new \Protobuf\MessageCollection(); } $this->method->add($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 \google\protobuf\ServiceOptions(); $this->options = $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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->method !== null) { foreach ($this->method as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->options !== null) { $innerSize = $this->options->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->name = null; $this->method = null; $this->options = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\ServiceDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->method = ($message->method !== null) ? $message->method : $this->method; $this->options = ($message->options !== null) ? $message->options : $this->options; } } Google/Protobuf/DescriptorProto.php000066400000100031147735112210013433 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.DescriptorProto */ class DescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * field repeated message = 2 * * @var \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> */ protected $field = null; /** * extension repeated message = 6 * * @var \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> */ protected $extension = null; /** * nested_type repeated message = 3 * * @var \Protobuf\Collection<\google\protobuf\DescriptorProto> */ protected $nested_type = null; /** * enum_type repeated message = 4 * * @var \Protobuf\Collection<\google\protobuf\EnumDescriptorProto> */ protected $enum_type = null; /** * extension_range repeated message = 5 * * @var \Protobuf\Collection<\google\protobuf\DescriptorProto\ExtensionRange> */ protected $extension_range = null; /** * oneof_decl repeated message = 8 * * @var \Protobuf\Collection<\google\protobuf\OneofDescriptorProto> */ protected $oneof_decl = null; /** * options optional message = 7 * * @var \google\protobuf\MessageOptions */ protected $options = null; /** * reserved_range repeated message = 9 * * @var \Protobuf\Collection<\google\protobuf\DescriptorProto\ReservedRange> */ protected $reserved_range = null; /** * reserved_name repeated string = 10 * * @var \Protobuf\Collection */ protected $reserved_name = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'field' has a value * * @return bool */ public function hasFieldList() { return $this->field !== null; } /** * Get 'field' value * * @return \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> */ public function getFieldList() { return $this->field; } /** * Set 'field' value * * @param \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> $value */ public function setFieldList(\Protobuf\Collection $value = null) { $this->field = $value; } /** * Add a new element to 'field' * * @param \google\protobuf\FieldDescriptorProto $value */ public function addField(\google\protobuf\FieldDescriptorProto $value) { if ($this->field === null) { $this->field = new \Protobuf\MessageCollection(); } $this->field->add($value); } /** * Check if 'extension' has a value * * @return bool */ public function hasExtensionList() { return $this->extension !== null; } /** * Get 'extension' value * * @return \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> */ public function getExtensionList() { return $this->extension; } /** * Set 'extension' value * * @param \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> $value */ public function setExtensionList(\Protobuf\Collection $value = null) { $this->extension = $value; } /** * Add a new element to 'extension' * * @param \google\protobuf\FieldDescriptorProto $value */ public function addExtension(\google\protobuf\FieldDescriptorProto $value) { if ($this->extension === null) { $this->extension = new \Protobuf\MessageCollection(); } $this->extension->add($value); } /** * Check if 'nested_type' has a value * * @return bool */ public function hasNestedTypeList() { return $this->nested_type !== null; } /** * Get 'nested_type' value * * @return \Protobuf\Collection<\google\protobuf\DescriptorProto> */ public function getNestedTypeList() { return $this->nested_type; } /** * Set 'nested_type' value * * @param \Protobuf\Collection<\google\protobuf\DescriptorProto> $value */ public function setNestedTypeList(\Protobuf\Collection $value = null) { $this->nested_type = $value; } /** * Add a new element to 'nested_type' * * @param \google\protobuf\DescriptorProto $value */ public function addNestedType(\google\protobuf\DescriptorProto $value) { if ($this->nested_type === null) { $this->nested_type = new \Protobuf\MessageCollection(); } $this->nested_type->add($value); } /** * Check if 'enum_type' has a value * * @return bool */ public function hasEnumTypeList() { return $this->enum_type !== null; } /** * Get 'enum_type' value * * @return \Protobuf\Collection<\google\protobuf\EnumDescriptorProto> */ public function getEnumTypeList() { return $this->enum_type; } /** * Set 'enum_type' value * * @param \Protobuf\Collection<\google\protobuf\EnumDescriptorProto> $value */ public function setEnumTypeList(\Protobuf\Collection $value = null) { $this->enum_type = $value; } /** * Add a new element to 'enum_type' * * @param \google\protobuf\EnumDescriptorProto $value */ public function addEnumType(\google\protobuf\EnumDescriptorProto $value) { if ($this->enum_type === null) { $this->enum_type = new \Protobuf\MessageCollection(); } $this->enum_type->add($value); } /** * Check if 'extension_range' has a value * * @return bool */ public function hasExtensionRangeList() { return $this->extension_range !== null; } /** * Get 'extension_range' value * * @return \Protobuf\Collection<\google\protobuf\DescriptorProto\ExtensionRange> */ public function getExtensionRangeList() { return $this->extension_range; } /** * Set 'extension_range' value * * @param \Protobuf\Collection<\google\protobuf\DescriptorProto\ExtensionRange> $value */ public function setExtensionRangeList(\Protobuf\Collection $value = null) { $this->extension_range = $value; } /** * Add a new element to 'extension_range' * * @param \google\protobuf\DescriptorProto\ExtensionRange $value */ public function addExtensionRange(\google\protobuf\DescriptorProto\ExtensionRange $value) { if ($this->extension_range === null) { $this->extension_range = new \Protobuf\MessageCollection(); } $this->extension_range->add($value); } /** * Check if 'oneof_decl' has a value * * @return bool */ public function hasOneofDeclList() { return $this->oneof_decl !== null; } /** * Get 'oneof_decl' value * * @return \Protobuf\Collection<\google\protobuf\OneofDescriptorProto> */ public function getOneofDeclList() { return $this->oneof_decl; } /** * Set 'oneof_decl' value * * @param \Protobuf\Collection<\google\protobuf\OneofDescriptorProto> $value */ public function setOneofDeclList(\Protobuf\Collection $value = null) { $this->oneof_decl = $value; } /** * Add a new element to 'oneof_decl' * * @param \google\protobuf\OneofDescriptorProto $value */ public function addOneofDecl(\google\protobuf\OneofDescriptorProto $value) { if ($this->oneof_decl === null) { $this->oneof_decl = new \Protobuf\MessageCollection(); } $this->oneof_decl->add($value); } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\MessageOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\MessageOptions $value */ public function setOptions(\google\protobuf\MessageOptions $value = null) { $this->options = $value; } /** * Check if 'reserved_range' has a value * * @return bool */ public function hasReservedRangeList() { return $this->reserved_range !== null; } /** * Get 'reserved_range' value * * @return \Protobuf\Collection<\google\protobuf\DescriptorProto\ReservedRange> */ public function getReservedRangeList() { return $this->reserved_range; } /** * Set 'reserved_range' value * * @param \Protobuf\Collection<\google\protobuf\DescriptorProto\ReservedRange> $value */ public function setReservedRangeList(\Protobuf\Collection $value = null) { $this->reserved_range = $value; } /** * Add a new element to 'reserved_range' * * @param \google\protobuf\DescriptorProto\ReservedRange $value */ public function addReservedRange(\google\protobuf\DescriptorProto\ReservedRange $value) { if ($this->reserved_range === null) { $this->reserved_range = new \Protobuf\MessageCollection(); } $this->reserved_range->add($value); } /** * Check if 'reserved_name' has a value * * @return bool */ public function hasReservedNameList() { return $this->reserved_name !== null; } /** * Get 'reserved_name' value * * @return \Protobuf\Collection */ public function getReservedNameList() { return $this->reserved_name; } /** * Set 'reserved_name' value * * @param \Protobuf\Collection $value */ public function setReservedNameList(\Protobuf\Collection $value = null) { $this->reserved_name = $value; } /** * Add a new element to 'reserved_name' * * @param string $value */ public function addReservedName($value) { if ($this->reserved_name === null) { $this->reserved_name = new \Protobuf\ScalarCollection(); } $this->reserved_name->add($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([ 'name' => null, 'field' => [], 'extension' => [], 'nested_type' => [], 'enum_type' => [], 'extension_range' => [], 'oneof_decl' => [], 'options' => null, 'reserved_range' => [], 'reserved_name' => [] ], $values); $message->setName($values['name']); $message->setOptions($values['options']); foreach ($values['field'] as $item) { $message->addField($item); } foreach ($values['extension'] as $item) { $message->addExtension($item); } foreach ($values['nested_type'] as $item) { $message->addNestedType($item); } foreach ($values['enum_type'] as $item) { $message->addEnumType($item); } foreach ($values['extension_range'] as $item) { $message->addExtensionRange($item); } foreach ($values['oneof_decl'] as $item) { $message->addOneofDecl($item); } foreach ($values['reserved_range'] as $item) { $message->addReservedRange($item); } foreach ($values['reserved_name'] as $item) { $message->addReservedName($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'DescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'field', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.FieldDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'extension', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.FieldDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'nested_type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.DescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 4, 'name' => 'enum_type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.EnumDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 5, 'name' => 'extension_range', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.DescriptorProto.ExtensionRange' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 8, 'name' => 'oneof_decl', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.OneofDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 7, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.MessageOptions' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 9, 'name' => 'reserved_range', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.DescriptorProto.ReservedRange' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 10, 'name' => 'reserved_name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->field !== null) { foreach ($this->field as $val) { $writer->writeVarint($stream, 18); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->extension !== null) { foreach ($this->extension as $val) { $writer->writeVarint($stream, 50); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->nested_type !== null) { foreach ($this->nested_type as $val) { $writer->writeVarint($stream, 26); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->enum_type !== null) { foreach ($this->enum_type as $val) { $writer->writeVarint($stream, 34); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->extension_range !== null) { foreach ($this->extension_range as $val) { $writer->writeVarint($stream, 42); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->oneof_decl !== null) { foreach ($this->oneof_decl as $val) { $writer->writeVarint($stream, 66); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->options !== null) { $writer->writeVarint($stream, 58); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->writeTo($context); } if ($this->reserved_range !== null) { foreach ($this->reserved_range as $val) { $writer->writeVarint($stream, 74); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->reserved_name !== null) { foreach ($this->reserved_name as $val) { $writer->writeVarint($stream, 82); $writer->writeString($stream, $val); } } 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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\FieldDescriptorProto(); if ($this->field === null) { $this->field = new \Protobuf\MessageCollection(); } $this->field->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\FieldDescriptorProto(); if ($this->extension === null) { $this->extension = new \Protobuf\MessageCollection(); } $this->extension->add($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 \google\protobuf\DescriptorProto(); if ($this->nested_type === null) { $this->nested_type = new \Protobuf\MessageCollection(); } $this->nested_type->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\EnumDescriptorProto(); if ($this->enum_type === null) { $this->enum_type = new \Protobuf\MessageCollection(); } $this->enum_type->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\DescriptorProto\ExtensionRange(); if ($this->extension_range === null) { $this->extension_range = new \Protobuf\MessageCollection(); } $this->extension_range->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 8) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\OneofDescriptorProto(); if ($this->oneof_decl === null) { $this->oneof_decl = new \Protobuf\MessageCollection(); } $this->oneof_decl->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 7) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\MessageOptions(); $this->options = $innerMessage; $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 9) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\DescriptorProto\ReservedRange(); if ($this->reserved_range === null) { $this->reserved_range = new \Protobuf\MessageCollection(); } $this->reserved_range->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 10) { \Protobuf\WireFormat::assertWireType($wire, 9); if ($this->reserved_name === null) { $this->reserved_name = new \Protobuf\ScalarCollection(); } $this->reserved_name->add($reader->readString($stream)); 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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->field !== null) { foreach ($this->field as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extension !== null) { foreach ($this->extension as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->nested_type !== null) { foreach ($this->nested_type as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->enum_type !== null) { foreach ($this->enum_type as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extension_range !== null) { foreach ($this->extension_range as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->oneof_decl !== null) { foreach ($this->oneof_decl as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->options !== null) { $innerSize = $this->options->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->reserved_range !== null) { foreach ($this->reserved_range as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->reserved_name !== null) { foreach ($this->reserved_name as $val) { $size += 1; $size += $calculator->computeStringSize($val); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name = null; $this->field = null; $this->extension = null; $this->nested_type = null; $this->enum_type = null; $this->extension_range = null; $this->oneof_decl = null; $this->options = null; $this->reserved_range = null; $this->reserved_name = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\DescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->field = ($message->field !== null) ? $message->field : $this->field; $this->extension = ($message->extension !== null) ? $message->extension : $this->extension; $this->nested_type = ($message->nested_type !== null) ? $message->nested_type : $this->nested_type; $this->enum_type = ($message->enum_type !== null) ? $message->enum_type : $this->enum_type; $this->extension_range = ($message->extension_range !== null) ? $message->extension_range : $this->extension_range; $this->oneof_decl = ($message->oneof_decl !== null) ? $message->oneof_decl : $this->oneof_decl; $this->options = ($message->options !== null) ? $message->options : $this->options; $this->reserved_range = ($message->reserved_range !== null) ? $message->reserved_range : $this->reserved_range; $this->reserved_name = ($message->reserved_name !== null) ? $message->reserved_name : $this->reserved_name; } } Google/Protobuf/FieldOptions/CType.php000066400000003616147735112210013727 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\FieldOptions; /** * Protobuf enum : google.protobuf.FieldOptions.CType */ class CType extends \Protobuf\Enum { /** * STRING = 0 */ const STRING_VALUE = 0; /** * CORD = 1 */ const CORD_VALUE = 1; /** * STRING_PIECE = 2 */ const STRING_PIECE_VALUE = 2; /** * @var \google\protobuf\FieldOptions\CType */ protected static $STRING = null; /** * @var \google\protobuf\FieldOptions\CType */ protected static $CORD = null; /** * @var \google\protobuf\FieldOptions\CType */ protected static $STRING_PIECE = null; /** * @return \google\protobuf\FieldOptions\CType */ public static function STRING() { if (self::$STRING !== null) { return self::$STRING; } return self::$STRING = new self('STRING', self::STRING_VALUE); } /** * @return \google\protobuf\FieldOptions\CType */ public static function CORD() { if (self::$CORD !== null) { return self::$CORD; } return self::$CORD = new self('CORD', self::CORD_VALUE); } /** * @return \google\protobuf\FieldOptions\CType */ public static function STRING_PIECE() { if (self::$STRING_PIECE !== null) { return self::$STRING_PIECE; } return self::$STRING_PIECE = new self('STRING_PIECE', self::STRING_PIECE_VALUE); } /** * @param int $value * @return \google\protobuf\FieldOptions\CType */ public static function valueOf($value) { switch ($value) { case 0: return self::STRING(); case 1: return self::CORD(); case 2: return self::STRING_PIECE(); default: return null; } } } Google/Protobuf/FieldOptions/JSType.php000066400000003711147735112210014055 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\FieldOptions; /** * Protobuf enum : google.protobuf.FieldOptions.JSType */ class JSType extends \Protobuf\Enum { /** * JS_NORMAL = 0 */ const JS_NORMAL_VALUE = 0; /** * JS_STRING = 1 */ const JS_STRING_VALUE = 1; /** * JS_NUMBER = 2 */ const JS_NUMBER_VALUE = 2; /** * @var \google\protobuf\FieldOptions\JSType */ protected static $JS_NORMAL = null; /** * @var \google\protobuf\FieldOptions\JSType */ protected static $JS_STRING = null; /** * @var \google\protobuf\FieldOptions\JSType */ protected static $JS_NUMBER = null; /** * @return \google\protobuf\FieldOptions\JSType */ public static function JS_NORMAL() { if (self::$JS_NORMAL !== null) { return self::$JS_NORMAL; } return self::$JS_NORMAL = new self('JS_NORMAL', self::JS_NORMAL_VALUE); } /** * @return \google\protobuf\FieldOptions\JSType */ public static function JS_STRING() { if (self::$JS_STRING !== null) { return self::$JS_STRING; } return self::$JS_STRING = new self('JS_STRING', self::JS_STRING_VALUE); } /** * @return \google\protobuf\FieldOptions\JSType */ public static function JS_NUMBER() { if (self::$JS_NUMBER !== null) { return self::$JS_NUMBER; } return self::$JS_NUMBER = new self('JS_NUMBER', self::JS_NUMBER_VALUE); } /** * @param int $value * @return \google\protobuf\FieldOptions\JSType */ public static function valueOf($value) { switch ($value) { case 0: return self::JS_NORMAL(); case 1: return self::JS_STRING(); case 2: return self::JS_NUMBER(); default: return null; } } } Google/Protobuf/php/Extension.php000066400000007165147735112210013052 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : php.proto */ namespace google\protobuf\php; /** * Protobuf extension : php.Extension */ class Extension implements \Protobuf\Extension { /** * Extension field : package optional string = 50002 * * @var \Protobuf\Extension */ protected static $package = null; /** * Extension field : generic_services optional bool = 50003 * * @var \Protobuf\Extension */ protected static $generic_services = null; /** * Register all extensions * * @param \Protobuf\Extension\ExtensionRegistry */ public static function registerAllExtensions(\Protobuf\Extension\ExtensionRegistry $registry) { $registry->add(self::package()); $registry->add(self::genericServices()); } /** * Extension field : package * * @return \Protobuf\Extension */ public static function package() { if (self::$package !== null) { return self::$package; } $readCallback = function (\Protobuf\ReadContext $context, $wire) { $reader = $context->getReader(); $length = $context->getLength(); $stream = $context->getStream(); \Protobuf\WireFormat::assertWireType($wire, 9); $value = $reader->readString($stream); return $value; }; $writeCallback = function (\Protobuf\WriteContext $context, $value) { $stream = $context->getStream(); $writer = $context->getWriter(); $sizeContext = $context->getComputeSizeContext(); $writer->writeVarint($stream, 400018); $writer->writeString($stream, $value); }; $sizeCallback = function (\Protobuf\ComputeSizeContext $context, $value) { $calculator = $context->getSizeCalculator(); $size = 0; $size += 3; $size += $calculator->computeStringSize($value); return $size; }; return self::$package = new \Protobuf\Extension\ExtensionField('\\google\\protobuf\\FileOptions', 'package', 50002, $readCallback, $writeCallback, $sizeCallback, __METHOD__); } /** * Extension field : generic_services * * @return \Protobuf\Extension */ public static function genericServices() { if (self::$generic_services !== null) { return self::$generic_services; } $readCallback = function (\Protobuf\ReadContext $context, $wire) { $reader = $context->getReader(); $length = $context->getLength(); $stream = $context->getStream(); \Protobuf\WireFormat::assertWireType($wire, 8); $value = $reader->readBool($stream); return $value; }; $writeCallback = function (\Protobuf\WriteContext $context, $value) { $stream = $context->getStream(); $writer = $context->getWriter(); $sizeContext = $context->getComputeSizeContext(); $writer->writeVarint($stream, 400024); $writer->writeBool($stream, $value); }; $sizeCallback = function (\Protobuf\ComputeSizeContext $context, $value) { $calculator = $context->getSizeCalculator(); $size = 0; $size += 3; $size += 1; return $size; }; return self::$generic_services = new \Protobuf\Extension\ExtensionField('\\google\\protobuf\\FileOptions', 'generic_services', 50003, $readCallback, $writeCallback, $sizeCallback, __METHOD__); } } Google/Protobuf/FileOptions/OptimizeMode.php000066400000003754147735112210015147 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\FileOptions; /** * Protobuf enum : google.protobuf.FileOptions.OptimizeMode */ class OptimizeMode extends \Protobuf\Enum { /** * SPEED = 1 */ const SPEED_VALUE = 1; /** * CODE_SIZE = 2 */ const CODE_SIZE_VALUE = 2; /** * LITE_RUNTIME = 3 */ const LITE_RUNTIME_VALUE = 3; /** * @var \google\protobuf\FileOptions\OptimizeMode */ protected static $SPEED = null; /** * @var \google\protobuf\FileOptions\OptimizeMode */ protected static $CODE_SIZE = null; /** * @var \google\protobuf\FileOptions\OptimizeMode */ protected static $LITE_RUNTIME = null; /** * @return \google\protobuf\FileOptions\OptimizeMode */ public static function SPEED() { if (self::$SPEED !== null) { return self::$SPEED; } return self::$SPEED = new self('SPEED', self::SPEED_VALUE); } /** * @return \google\protobuf\FileOptions\OptimizeMode */ public static function CODE_SIZE() { if (self::$CODE_SIZE !== null) { return self::$CODE_SIZE; } return self::$CODE_SIZE = new self('CODE_SIZE', self::CODE_SIZE_VALUE); } /** * @return \google\protobuf\FileOptions\OptimizeMode */ public static function LITE_RUNTIME() { if (self::$LITE_RUNTIME !== null) { return self::$LITE_RUNTIME; } return self::$LITE_RUNTIME = new self('LITE_RUNTIME', self::LITE_RUNTIME_VALUE); } /** * @param int $value * @return \google\protobuf\FileOptions\OptimizeMode */ public static function valueOf($value) { switch ($value) { case 1: return self::SPEED(); case 2: return self::CODE_SIZE(); case 3: return self::LITE_RUNTIME(); default: return null; } } } Google/Protobuf/compiler/CodeGeneratorResponse.php000066400000021601147735112210016350 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : plugin.proto */ namespace google\protobuf\compiler; /** * Protobuf message : google.protobuf.compiler.CodeGeneratorResponse */ class CodeGeneratorResponse extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * error optional string = 1 * * @var string */ protected $error = null; /** * file repeated message = 15 * * @var \Protobuf\Collection<\google\protobuf\compiler\CodeGeneratorResponse\File> */ protected $file = null; /** * Check if 'error' has a value * * @return bool */ public function hasError() { return $this->error !== null; } /** * Get 'error' value * * @return string */ public function getError() { return $this->error; } /** * Set 'error' value * * @param string $value */ public function setError($value = null) { $this->error = $value; } /** * Check if 'file' has a value * * @return bool */ public function hasFileList() { return $this->file !== null; } /** * Get 'file' value * * @return \Protobuf\Collection<\google\protobuf\compiler\CodeGeneratorResponse\File> */ public function getFileList() { return $this->file; } /** * Set 'file' value * * @param \Protobuf\Collection<\google\protobuf\compiler\CodeGeneratorResponse\File> $value */ public function setFileList(\Protobuf\Collection $value = null) { $this->file = $value; } /** * Add a new element to 'file' * * @param \google\protobuf\compiler\CodeGeneratorResponse\File $value */ public function addFile(\google\protobuf\compiler\CodeGeneratorResponse\File $value) { if ($this->file === null) { $this->file = new \Protobuf\MessageCollection(); } $this->file->add($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([ 'error' => null, 'file' => [] ], $values); $message->setError($values['error']); foreach ($values['file'] as $item) { $message->addFile($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'CodeGeneratorResponse', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'error', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 15, 'name' => 'file', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.compiler.CodeGeneratorResponse.File' ]), ], ]); } /** * {@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->error !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->error); } if ($this->file !== null) { foreach ($this->file as $val) { $writer->writeVarint($stream, 122); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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, 9); $this->error = $reader->readString($stream); continue; } if ($tag === 15) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\compiler\CodeGeneratorResponse\File(); if ($this->file === null) { $this->file = new \Protobuf\MessageCollection(); } $this->file->add($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->error !== null) { $size += 1; $size += $calculator->computeStringSize($this->error); } if ($this->file !== null) { foreach ($this->file as $val) { $innerSize = $val->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->error = null; $this->file = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\compiler\CodeGeneratorResponse) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->error = ($message->error !== null) ? $message->error : $this->error; $this->file = ($message->file !== null) ? $message->file : $this->file; } } Google/Protobuf/compiler/CodeGeneratorResponse/File.php000066400000022440147735112210017231 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : plugin.proto */ namespace google\protobuf\compiler\CodeGeneratorResponse; /** * Protobuf message : google.protobuf.compiler.CodeGeneratorResponse.File */ class File extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * insertion_point optional string = 2 * * @var string */ protected $insertion_point = null; /** * content optional string = 15 * * @var string */ protected $content = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'insertion_point' has a value * * @return bool */ public function hasInsertionPoint() { return $this->insertion_point !== null; } /** * Get 'insertion_point' value * * @return string */ public function getInsertionPoint() { return $this->insertion_point; } /** * Set 'insertion_point' value * * @param string $value */ public function setInsertionPoint($value = null) { $this->insertion_point = $value; } /** * Check if 'content' has a value * * @return bool */ public function hasContent() { return $this->content !== null; } /** * Get 'content' value * * @return string */ public function getContent() { return $this->content; } /** * Set 'content' value * * @param string $value */ public function setContent($value = null) { $this->content = $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([ 'name' => null, 'insertion_point' => null, 'content' => null ], $values); $message->setName($values['name']); $message->setInsertionPoint($values['insertion_point']); $message->setContent($values['content']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'File', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'insertion_point', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 15, 'name' => 'content', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->insertion_point !== null) { $writer->writeVarint($stream, 18); $writer->writeString($stream, $this->insertion_point); } if ($this->content !== null) { $writer->writeVarint($stream, 122); $writer->writeString($stream, $this->content); } 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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->insertion_point = $reader->readString($stream); continue; } if ($tag === 15) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->content = $reader->readString($stream); 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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->insertion_point !== null) { $size += 1; $size += $calculator->computeStringSize($this->insertion_point); } if ($this->content !== null) { $size += 1; $size += $calculator->computeStringSize($this->content); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name = null; $this->insertion_point = null; $this->content = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\compiler\CodeGeneratorResponse\File) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->insertion_point = ($message->insertion_point !== null) ? $message->insertion_point : $this->insertion_point; $this->content = ($message->content !== null) ? $message->content : $this->content; } } Google/Protobuf/compiler/CodeGeneratorRequest.php000066400000027116147735112210016211 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : plugin.proto */ namespace google\protobuf\compiler; /** * Protobuf message : google.protobuf.compiler.CodeGeneratorRequest */ class CodeGeneratorRequest extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * file_to_generate repeated string = 1 * * @var \Protobuf\Collection */ protected $file_to_generate = null; /** * parameter optional string = 2 * * @var string */ protected $parameter = null; /** * proto_file repeated message = 15 * * @var \Protobuf\Collection<\google\protobuf\FileDescriptorProto> */ protected $proto_file = null; /** * Check if 'file_to_generate' has a value * * @return bool */ public function hasFileToGenerateList() { return $this->file_to_generate !== null; } /** * Get 'file_to_generate' value * * @return \Protobuf\Collection */ public function getFileToGenerateList() { return $this->file_to_generate; } /** * Set 'file_to_generate' value * * @param \Protobuf\Collection $value */ public function setFileToGenerateList(\Protobuf\Collection $value = null) { $this->file_to_generate = $value; } /** * Add a new element to 'file_to_generate' * * @param string $value */ public function addFileToGenerate($value) { if ($this->file_to_generate === null) { $this->file_to_generate = new \Protobuf\ScalarCollection(); } $this->file_to_generate->add($value); } /** * Check if 'parameter' has a value * * @return bool */ public function hasParameter() { return $this->parameter !== null; } /** * Get 'parameter' value * * @return string */ public function getParameter() { return $this->parameter; } /** * Set 'parameter' value * * @param string $value */ public function setParameter($value = null) { $this->parameter = $value; } /** * Check if 'proto_file' has a value * * @return bool */ public function hasProtoFileList() { return $this->proto_file !== null; } /** * Get 'proto_file' value * * @return \Protobuf\Collection<\google\protobuf\FileDescriptorProto> */ public function getProtoFileList() { return $this->proto_file; } /** * Set 'proto_file' value * * @param \Protobuf\Collection<\google\protobuf\FileDescriptorProto> $value */ public function setProtoFileList(\Protobuf\Collection $value = null) { $this->proto_file = $value; } /** * Add a new element to 'proto_file' * * @param \google\protobuf\FileDescriptorProto $value */ public function addProtoFile(\google\protobuf\FileDescriptorProto $value) { if ($this->proto_file === null) { $this->proto_file = new \Protobuf\MessageCollection(); } $this->proto_file->add($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([ 'file_to_generate' => [], 'parameter' => null, 'proto_file' => [] ], $values); $message->setParameter($values['parameter']); foreach ($values['file_to_generate'] as $item) { $message->addFileToGenerate($item); } foreach ($values['proto_file'] as $item) { $message->addProtoFile($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'CodeGeneratorRequest', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'file_to_generate', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'parameter', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 15, 'name' => 'proto_file', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.FileDescriptorProto' ]), ], ]); } /** * {@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->file_to_generate !== null) { foreach ($this->file_to_generate as $val) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $val); } } if ($this->parameter !== null) { $writer->writeVarint($stream, 18); $writer->writeString($stream, $this->parameter); } if ($this->proto_file !== null) { foreach ($this->proto_file as $val) { $writer->writeVarint($stream, 122); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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, 9); if ($this->file_to_generate === null) { $this->file_to_generate = new \Protobuf\ScalarCollection(); } $this->file_to_generate->add($reader->readString($stream)); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->parameter = $reader->readString($stream); continue; } if ($tag === 15) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\FileDescriptorProto(); if ($this->proto_file === null) { $this->proto_file = new \Protobuf\MessageCollection(); } $this->proto_file->add($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->file_to_generate !== null) { foreach ($this->file_to_generate as $val) { $size += 1; $size += $calculator->computeStringSize($val); } } if ($this->parameter !== null) { $size += 1; $size += $calculator->computeStringSize($this->parameter); } if ($this->proto_file !== null) { foreach ($this->proto_file as $val) { $innerSize = $val->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->file_to_generate = null; $this->parameter = null; $this->proto_file = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\compiler\CodeGeneratorRequest) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->file_to_generate = ($message->file_to_generate !== null) ? $message->file_to_generate : $this->file_to_generate; $this->parameter = ($message->parameter !== null) ? $message->parameter : $this->parameter; $this->proto_file = ($message->proto_file !== null) ? $message->proto_file : $this->proto_file; } } Google/Protobuf/EnumValueDescriptorProto.php000066400000023243147735112210015266 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.EnumValueDescriptorProto */ class EnumValueDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * number optional int32 = 2 * * @var int */ protected $number = null; /** * options optional message = 3 * * @var \google\protobuf\EnumValueOptions */ protected $options = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'number' has a value * * @return bool */ public function hasNumber() { return $this->number !== null; } /** * Get 'number' value * * @return int */ public function getNumber() { return $this->number; } /** * Set 'number' value * * @param int $value */ public function setNumber($value = null) { $this->number = $value; } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\EnumValueOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\EnumValueOptions $value */ public function setOptions(\google\protobuf\EnumValueOptions $value = null) { $this->options = $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([ 'name' => null, 'number' => null, 'options' => null ], $values); $message->setName($values['name']); $message->setNumber($values['number']); $message->setOptions($values['options']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'EnumValueDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'number', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.EnumValueOptions' ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->number !== null) { $writer->writeVarint($stream, 16); $writer->writeVarint($stream, $this->number); } if ($this->options !== null) { $writer->writeVarint($stream, 26); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->number = $reader->readVarint($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\EnumValueOptions(); $this->options = $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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->number !== null) { $size += 1; $size += $calculator->computeVarintSize($this->number); } if ($this->options !== null) { $innerSize = $this->options->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->name = null; $this->number = null; $this->options = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\EnumValueDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->number = ($message->number !== null) ? $message->number : $this->number; $this->options = ($message->options !== null) ? $message->options : $this->options; } } Google/Protobuf/FileDescriptorProto.php000066400000102257147735112210014247 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.FileDescriptorProto */ class FileDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * package optional string = 2 * * @var string */ protected $package = null; /** * dependency repeated string = 3 * * @var \Protobuf\Collection */ protected $dependency = null; /** * public_dependency repeated int32 = 10 * * @var \Protobuf\Collection */ protected $public_dependency = null; /** * weak_dependency repeated int32 = 11 * * @var \Protobuf\Collection */ protected $weak_dependency = null; /** * message_type repeated message = 4 * * @var \Protobuf\Collection<\google\protobuf\DescriptorProto> */ protected $message_type = null; /** * enum_type repeated message = 5 * * @var \Protobuf\Collection<\google\protobuf\EnumDescriptorProto> */ protected $enum_type = null; /** * service repeated message = 6 * * @var \Protobuf\Collection<\google\protobuf\ServiceDescriptorProto> */ protected $service = null; /** * extension repeated message = 7 * * @var \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> */ protected $extension = null; /** * options optional message = 8 * * @var \google\protobuf\FileOptions */ protected $options = null; /** * source_code_info optional message = 9 * * @var \google\protobuf\SourceCodeInfo */ protected $source_code_info = null; /** * syntax optional string = 12 * * @var string */ protected $syntax = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'package' has a value * * @return bool */ public function hasPackage() { return $this->package !== null; } /** * Get 'package' value * * @return string */ public function getPackage() { return $this->package; } /** * Set 'package' value * * @param string $value */ public function setPackage($value = null) { $this->package = $value; } /** * Check if 'dependency' has a value * * @return bool */ public function hasDependencyList() { return $this->dependency !== null; } /** * Get 'dependency' value * * @return \Protobuf\Collection */ public function getDependencyList() { return $this->dependency; } /** * Set 'dependency' value * * @param \Protobuf\Collection $value */ public function setDependencyList(\Protobuf\Collection $value = null) { $this->dependency = $value; } /** * Add a new element to 'dependency' * * @param string $value */ public function addDependency($value) { if ($this->dependency === null) { $this->dependency = new \Protobuf\ScalarCollection(); } $this->dependency->add($value); } /** * Check if 'public_dependency' has a value * * @return bool */ public function hasPublicDependencyList() { return $this->public_dependency !== null; } /** * Get 'public_dependency' value * * @return \Protobuf\Collection */ public function getPublicDependencyList() { return $this->public_dependency; } /** * Set 'public_dependency' value * * @param \Protobuf\Collection $value */ public function setPublicDependencyList(\Protobuf\Collection $value = null) { $this->public_dependency = $value; } /** * Add a new element to 'public_dependency' * * @param int $value */ public function addPublicDependency($value) { if ($this->public_dependency === null) { $this->public_dependency = new \Protobuf\ScalarCollection(); } $this->public_dependency->add($value); } /** * Check if 'weak_dependency' has a value * * @return bool */ public function hasWeakDependencyList() { return $this->weak_dependency !== null; } /** * Get 'weak_dependency' value * * @return \Protobuf\Collection */ public function getWeakDependencyList() { return $this->weak_dependency; } /** * Set 'weak_dependency' value * * @param \Protobuf\Collection $value */ public function setWeakDependencyList(\Protobuf\Collection $value = null) { $this->weak_dependency = $value; } /** * Add a new element to 'weak_dependency' * * @param int $value */ public function addWeakDependency($value) { if ($this->weak_dependency === null) { $this->weak_dependency = new \Protobuf\ScalarCollection(); } $this->weak_dependency->add($value); } /** * Check if 'message_type' has a value * * @return bool */ public function hasMessageTypeList() { return $this->message_type !== null; } /** * Get 'message_type' value * * @return \Protobuf\Collection<\google\protobuf\DescriptorProto> */ public function getMessageTypeList() { return $this->message_type; } /** * Set 'message_type' value * * @param \Protobuf\Collection<\google\protobuf\DescriptorProto> $value */ public function setMessageTypeList(\Protobuf\Collection $value = null) { $this->message_type = $value; } /** * Add a new element to 'message_type' * * @param \google\protobuf\DescriptorProto $value */ public function addMessageType(\google\protobuf\DescriptorProto $value) { if ($this->message_type === null) { $this->message_type = new \Protobuf\MessageCollection(); } $this->message_type->add($value); } /** * Check if 'enum_type' has a value * * @return bool */ public function hasEnumTypeList() { return $this->enum_type !== null; } /** * Get 'enum_type' value * * @return \Protobuf\Collection<\google\protobuf\EnumDescriptorProto> */ public function getEnumTypeList() { return $this->enum_type; } /** * Set 'enum_type' value * * @param \Protobuf\Collection<\google\protobuf\EnumDescriptorProto> $value */ public function setEnumTypeList(\Protobuf\Collection $value = null) { $this->enum_type = $value; } /** * Add a new element to 'enum_type' * * @param \google\protobuf\EnumDescriptorProto $value */ public function addEnumType(\google\protobuf\EnumDescriptorProto $value) { if ($this->enum_type === null) { $this->enum_type = new \Protobuf\MessageCollection(); } $this->enum_type->add($value); } /** * Check if 'service' has a value * * @return bool */ public function hasServiceList() { return $this->service !== null; } /** * Get 'service' value * * @return \Protobuf\Collection<\google\protobuf\ServiceDescriptorProto> */ public function getServiceList() { return $this->service; } /** * Set 'service' value * * @param \Protobuf\Collection<\google\protobuf\ServiceDescriptorProto> $value */ public function setServiceList(\Protobuf\Collection $value = null) { $this->service = $value; } /** * Add a new element to 'service' * * @param \google\protobuf\ServiceDescriptorProto $value */ public function addService(\google\protobuf\ServiceDescriptorProto $value) { if ($this->service === null) { $this->service = new \Protobuf\MessageCollection(); } $this->service->add($value); } /** * Check if 'extension' has a value * * @return bool */ public function hasExtensionList() { return $this->extension !== null; } /** * Get 'extension' value * * @return \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> */ public function getExtensionList() { return $this->extension; } /** * Set 'extension' value * * @param \Protobuf\Collection<\google\protobuf\FieldDescriptorProto> $value */ public function setExtensionList(\Protobuf\Collection $value = null) { $this->extension = $value; } /** * Add a new element to 'extension' * * @param \google\protobuf\FieldDescriptorProto $value */ public function addExtension(\google\protobuf\FieldDescriptorProto $value) { if ($this->extension === null) { $this->extension = new \Protobuf\MessageCollection(); } $this->extension->add($value); } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\FileOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\FileOptions $value */ public function setOptions(\google\protobuf\FileOptions $value = null) { $this->options = $value; } /** * Check if 'source_code_info' has a value * * @return bool */ public function hasSourceCodeInfo() { return $this->source_code_info !== null; } /** * Get 'source_code_info' value * * @return \google\protobuf\SourceCodeInfo */ public function getSourceCodeInfo() { return $this->source_code_info; } /** * Set 'source_code_info' value * * @param \google\protobuf\SourceCodeInfo $value */ public function setSourceCodeInfo(\google\protobuf\SourceCodeInfo $value = null) { $this->source_code_info = $value; } /** * Check if 'syntax' has a value * * @return bool */ public function hasSyntax() { return $this->syntax !== null; } /** * Get 'syntax' value * * @return string */ public function getSyntax() { return $this->syntax; } /** * Set 'syntax' value * * @param string $value */ public function setSyntax($value = null) { $this->syntax = $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([ 'name' => null, 'package' => null, 'dependency' => [], 'public_dependency' => [], 'weak_dependency' => [], 'message_type' => [], 'enum_type' => [], 'service' => [], 'extension' => [], 'options' => null, 'source_code_info' => null, 'syntax' => null ], $values); $message->setName($values['name']); $message->setPackage($values['package']); $message->setOptions($values['options']); $message->setSourceCodeInfo($values['source_code_info']); $message->setSyntax($values['syntax']); foreach ($values['dependency'] as $item) { $message->addDependency($item); } foreach ($values['public_dependency'] as $item) { $message->addPublicDependency($item); } foreach ($values['weak_dependency'] as $item) { $message->addWeakDependency($item); } foreach ($values['message_type'] as $item) { $message->addMessageType($item); } foreach ($values['enum_type'] as $item) { $message->addEnumType($item); } foreach ($values['service'] as $item) { $message->addService($item); } foreach ($values['extension'] as $item) { $message->addExtension($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'FileDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'package', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'dependency', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 10, 'name' => 'public_dependency', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 11, 'name' => 'weak_dependency', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 4, 'name' => 'message_type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.DescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 5, 'name' => 'enum_type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.EnumDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'service', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.ServiceDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 7, 'name' => 'extension', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.FieldDescriptorProto' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 8, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FileOptions' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 9, 'name' => 'source_code_info', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.SourceCodeInfo' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 12, 'name' => 'syntax', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->package !== null) { $writer->writeVarint($stream, 18); $writer->writeString($stream, $this->package); } if ($this->dependency !== null) { foreach ($this->dependency as $val) { $writer->writeVarint($stream, 26); $writer->writeString($stream, $val); } } if ($this->public_dependency !== null) { foreach ($this->public_dependency as $val) { $writer->writeVarint($stream, 80); $writer->writeVarint($stream, $val); } } if ($this->weak_dependency !== null) { foreach ($this->weak_dependency as $val) { $writer->writeVarint($stream, 88); $writer->writeVarint($stream, $val); } } if ($this->message_type !== null) { foreach ($this->message_type as $val) { $writer->writeVarint($stream, 34); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->enum_type !== null) { foreach ($this->enum_type as $val) { $writer->writeVarint($stream, 42); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->service !== null) { foreach ($this->service as $val) { $writer->writeVarint($stream, 50); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->extension !== null) { foreach ($this->extension as $val) { $writer->writeVarint($stream, 58); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->writeTo($context); } } if ($this->options !== null) { $writer->writeVarint($stream, 66); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->writeTo($context); } if ($this->source_code_info !== null) { $writer->writeVarint($stream, 74); $writer->writeVarint($stream, $this->source_code_info->serializedSize($sizeContext)); $this->source_code_info->writeTo($context); } if ($this->syntax !== null) { $writer->writeVarint($stream, 98); $writer->writeString($stream, $this->syntax); } 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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->package = $reader->readString($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 9); if ($this->dependency === null) { $this->dependency = new \Protobuf\ScalarCollection(); } $this->dependency->add($reader->readString($stream)); continue; } if ($tag === 10) { \Protobuf\WireFormat::assertWireType($wire, 5); if ($this->public_dependency === null) { $this->public_dependency = new \Protobuf\ScalarCollection(); } $this->public_dependency->add($reader->readVarint($stream)); continue; } if ($tag === 11) { \Protobuf\WireFormat::assertWireType($wire, 5); if ($this->weak_dependency === null) { $this->weak_dependency = new \Protobuf\ScalarCollection(); } $this->weak_dependency->add($reader->readVarint($stream)); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\DescriptorProto(); if ($this->message_type === null) { $this->message_type = new \Protobuf\MessageCollection(); } $this->message_type->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\EnumDescriptorProto(); if ($this->enum_type === null) { $this->enum_type = new \Protobuf\MessageCollection(); } $this->enum_type->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\ServiceDescriptorProto(); if ($this->service === null) { $this->service = new \Protobuf\MessageCollection(); } $this->service->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 7) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\FieldDescriptorProto(); if ($this->extension === null) { $this->extension = new \Protobuf\MessageCollection(); } $this->extension->add($innerMessage); $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 8) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\FileOptions(); $this->options = $innerMessage; $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 9) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\SourceCodeInfo(); $this->source_code_info = $innerMessage; $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 12) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->syntax = $reader->readString($stream); 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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->package !== null) { $size += 1; $size += $calculator->computeStringSize($this->package); } if ($this->dependency !== null) { foreach ($this->dependency as $val) { $size += 1; $size += $calculator->computeStringSize($val); } } if ($this->public_dependency !== null) { foreach ($this->public_dependency as $val) { $size += 1; $size += $calculator->computeVarintSize($val); } } if ($this->weak_dependency !== null) { foreach ($this->weak_dependency as $val) { $size += 1; $size += $calculator->computeVarintSize($val); } } if ($this->message_type !== null) { foreach ($this->message_type as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->enum_type !== null) { foreach ($this->enum_type as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->service !== null) { foreach ($this->service as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extension !== null) { foreach ($this->extension as $val) { $innerSize = $val->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->options !== null) { $innerSize = $this->options->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->source_code_info !== null) { $innerSize = $this->source_code_info->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->syntax !== null) { $size += 1; $size += $calculator->computeStringSize($this->syntax); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name = null; $this->package = null; $this->dependency = null; $this->public_dependency = null; $this->weak_dependency = null; $this->message_type = null; $this->enum_type = null; $this->service = null; $this->extension = null; $this->options = null; $this->source_code_info = null; $this->syntax = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\FileDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->package = ($message->package !== null) ? $message->package : $this->package; $this->dependency = ($message->dependency !== null) ? $message->dependency : $this->dependency; $this->public_dependency = ($message->public_dependency !== null) ? $message->public_dependency : $this->public_dependency; $this->weak_dependency = ($message->weak_dependency !== null) ? $message->weak_dependency : $this->weak_dependency; $this->message_type = ($message->message_type !== null) ? $message->message_type : $this->message_type; $this->enum_type = ($message->enum_type !== null) ? $message->enum_type : $this->enum_type; $this->service = ($message->service !== null) ? $message->service : $this->service; $this->extension = ($message->extension !== null) ? $message->extension : $this->extension; $this->options = ($message->options !== null) ? $message->options : $this->options; $this->source_code_info = ($message->source_code_info !== null) ? $message->source_code_info : $this->source_code_info; $this->syntax = ($message->syntax !== null) ? $message->syntax : $this->syntax; } } Google/Protobuf/EnumOptions.php000066400000026267147735112210012573 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.EnumOptions */ class EnumOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * allow_alias optional bool = 2 * * @var bool */ protected $allow_alias = null; /** * deprecated optional bool = 3 * * @var bool */ protected $deprecated = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->deprecated = false; parent::__construct($stream, $configuration); } /** * Check if 'allow_alias' has a value * * @return bool */ public function hasAllowAlias() { return $this->allow_alias !== null; } /** * Get 'allow_alias' value * * @return bool */ public function getAllowAlias() { return $this->allow_alias; } /** * Set 'allow_alias' value * * @param bool $value */ public function setAllowAlias($value = null) { $this->allow_alias = $value; } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'allow_alias' => null, 'deprecated' => false, 'uninterpreted_option' => [] ], $values); $message->setAllowAlias($values['allow_alias']); $message->setDeprecated($values['deprecated']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'EnumOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'allow_alias', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->allow_alias !== null) { $writer->writeVarint($stream, 16); $writer->writeBool($stream, $this->allow_alias); } if ($this->deprecated !== null) { $writer->writeVarint($stream, 24); $writer->writeBool($stream, $this->deprecated); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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 === 2) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->allow_alias = $reader->readBool($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->allow_alias !== null) { $size += 1; $size += 1; } if ($this->deprecated !== null) { $size += 1; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->allow_alias = null; $this->deprecated = false; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\EnumOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->allow_alias = ($message->allow_alias !== null) ? $message->allow_alias : $this->allow_alias; $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/ServiceOptions.php000066400000023073147735112210013257 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.ServiceOptions */ class ServiceOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * deprecated optional bool = 33 * * @var bool */ protected $deprecated = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->deprecated = false; parent::__construct($stream, $configuration); } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'deprecated' => false, 'uninterpreted_option' => [] ], $values); $message->setDeprecated($values['deprecated']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'ServiceOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 33, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->deprecated !== null) { $writer->writeVarint($stream, 264); $writer->writeBool($stream, $this->deprecated); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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 === 33) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->deprecated !== null) { $size += 2; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->deprecated = false; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\ServiceOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/MethodDescriptorProto.php000066400000036475147735112210014620 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.MethodDescriptorProto */ class MethodDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * input_type optional string = 2 * * @var string */ protected $input_type = null; /** * output_type optional string = 3 * * @var string */ protected $output_type = null; /** * options optional message = 4 * * @var \google\protobuf\MethodOptions */ protected $options = null; /** * client_streaming optional bool = 5 * * @var bool */ protected $client_streaming = null; /** * server_streaming optional bool = 6 * * @var bool */ protected $server_streaming = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->client_streaming = false; $this->server_streaming = false; parent::__construct($stream, $configuration); } /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'input_type' has a value * * @return bool */ public function hasInputType() { return $this->input_type !== null; } /** * Get 'input_type' value * * @return string */ public function getInputType() { return $this->input_type; } /** * Set 'input_type' value * * @param string $value */ public function setInputType($value = null) { $this->input_type = $value; } /** * Check if 'output_type' has a value * * @return bool */ public function hasOutputType() { return $this->output_type !== null; } /** * Get 'output_type' value * * @return string */ public function getOutputType() { return $this->output_type; } /** * Set 'output_type' value * * @param string $value */ public function setOutputType($value = null) { $this->output_type = $value; } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\MethodOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\MethodOptions $value */ public function setOptions(\google\protobuf\MethodOptions $value = null) { $this->options = $value; } /** * Check if 'client_streaming' has a value * * @return bool */ public function hasClientStreaming() { return $this->client_streaming !== null; } /** * Get 'client_streaming' value * * @return bool */ public function getClientStreaming() { return $this->client_streaming; } /** * Set 'client_streaming' value * * @param bool $value */ public function setClientStreaming($value = null) { $this->client_streaming = $value; } /** * Check if 'server_streaming' has a value * * @return bool */ public function hasServerStreaming() { return $this->server_streaming !== null; } /** * Get 'server_streaming' value * * @return bool */ public function getServerStreaming() { return $this->server_streaming; } /** * Set 'server_streaming' value * * @param bool $value */ public function setServerStreaming($value = null) { $this->server_streaming = $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([ 'name' => null, 'input_type' => null, 'output_type' => null, 'options' => null, 'client_streaming' => false, 'server_streaming' => false ], $values); $message->setName($values['name']); $message->setInputType($values['input_type']); $message->setOutputType($values['output_type']); $message->setOptions($values['options']); $message->setClientStreaming($values['client_streaming']); $message->setServerStreaming($values['server_streaming']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'MethodDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'input_type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'output_type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 4, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.MethodOptions' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 5, 'name' => 'client_streaming', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'server_streaming', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->input_type !== null) { $writer->writeVarint($stream, 18); $writer->writeString($stream, $this->input_type); } if ($this->output_type !== null) { $writer->writeVarint($stream, 26); $writer->writeString($stream, $this->output_type); } if ($this->options !== null) { $writer->writeVarint($stream, 34); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->writeTo($context); } if ($this->client_streaming !== null) { $writer->writeVarint($stream, 40); $writer->writeBool($stream, $this->client_streaming); } if ($this->server_streaming !== null) { $writer->writeVarint($stream, 48); $writer->writeBool($stream, $this->server_streaming); } 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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->input_type = $reader->readString($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->output_type = $reader->readString($stream); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\MethodOptions(); $this->options = $innerMessage; $context->setLength($innerSize); $innerMessage->readFrom($context); $context->setLength($length); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->client_streaming = $reader->readBool($stream); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->server_streaming = $reader->readBool($stream); 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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->input_type !== null) { $size += 1; $size += $calculator->computeStringSize($this->input_type); } if ($this->output_type !== null) { $size += 1; $size += $calculator->computeStringSize($this->output_type); } if ($this->options !== null) { $innerSize = $this->options->serializedSize($context); $size += 1; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } if ($this->client_streaming !== null) { $size += 1; $size += 1; } if ($this->server_streaming !== null) { $size += 1; $size += 1; } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name = null; $this->input_type = null; $this->output_type = null; $this->options = null; $this->client_streaming = false; $this->server_streaming = false; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\MethodDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->input_type = ($message->input_type !== null) ? $message->input_type : $this->input_type; $this->output_type = ($message->output_type !== null) ? $message->output_type : $this->output_type; $this->options = ($message->options !== null) ? $message->options : $this->options; $this->client_streaming = ($message->client_streaming !== null) ? $message->client_streaming : $this->client_streaming; $this->server_streaming = ($message->server_streaming !== null) ? $message->server_streaming : $this->server_streaming; } } Google/Protobuf/FieldDescriptorProto.php000066400000053250147735112210014411 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.FieldDescriptorProto */ class FieldDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * number optional int32 = 3 * * @var int */ protected $number = null; /** * label optional enum = 4 * * @var \google\protobuf\FieldDescriptorProto\Label */ protected $label = null; /** * type optional enum = 5 * * @var \google\protobuf\FieldDescriptorProto\Type */ protected $type = null; /** * type_name optional string = 6 * * @var string */ protected $type_name = null; /** * extendee optional string = 2 * * @var string */ protected $extendee = null; /** * default_value optional string = 7 * * @var string */ protected $default_value = null; /** * oneof_index optional int32 = 9 * * @var int */ protected $oneof_index = null; /** * json_name optional string = 10 * * @var string */ protected $json_name = null; /** * options optional message = 8 * * @var \google\protobuf\FieldOptions */ protected $options = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $value; } /** * Check if 'number' has a value * * @return bool */ public function hasNumber() { return $this->number !== null; } /** * Get 'number' value * * @return int */ public function getNumber() { return $this->number; } /** * Set 'number' value * * @param int $value */ public function setNumber($value = null) { $this->number = $value; } /** * Check if 'label' has a value * * @return bool */ public function hasLabel() { return $this->label !== null; } /** * Get 'label' value * * @return \google\protobuf\FieldDescriptorProto\Label */ public function getLabel() { return $this->label; } /** * Set 'label' value * * @param \google\protobuf\FieldDescriptorProto\Label $value */ public function setLabel(\google\protobuf\FieldDescriptorProto\Label $value = null) { $this->label = $value; } /** * Check if 'type' has a value * * @return bool */ public function hasType() { return $this->type !== null; } /** * Get 'type' value * * @return \google\protobuf\FieldDescriptorProto\Type */ public function getType() { return $this->type; } /** * Set 'type' value * * @param \google\protobuf\FieldDescriptorProto\Type $value */ public function setType(\google\protobuf\FieldDescriptorProto\Type $value = null) { $this->type = $value; } /** * Check if 'type_name' has a value * * @return bool */ public function hasTypeName() { return $this->type_name !== null; } /** * Get 'type_name' value * * @return string */ public function getTypeName() { return $this->type_name; } /** * Set 'type_name' value * * @param string $value */ public function setTypeName($value = null) { $this->type_name = $value; } /** * Check if 'extendee' has a value * * @return bool */ public function hasExtendee() { return $this->extendee !== null; } /** * Get 'extendee' value * * @return string */ public function getExtendee() { return $this->extendee; } /** * Set 'extendee' value * * @param string $value */ public function setExtendee($value = null) { $this->extendee = $value; } /** * Check if 'default_value' has a value * * @return bool */ public function hasDefaultValue() { return $this->default_value !== null; } /** * Get 'default_value' value * * @return string */ public function getDefaultValue() { return $this->default_value; } /** * Set 'default_value' value * * @param string $value */ public function setDefaultValue($value = null) { $this->default_value = $value; } /** * Check if 'oneof_index' has a value * * @return bool */ public function hasOneofIndex() { return $this->oneof_index !== null; } /** * Get 'oneof_index' value * * @return int */ public function getOneofIndex() { return $this->oneof_index; } /** * Set 'oneof_index' value * * @param int $value */ public function setOneofIndex($value = null) { $this->oneof_index = $value; } /** * Check if 'json_name' has a value * * @return bool */ public function hasJsonName() { return $this->json_name !== null; } /** * Get 'json_name' value * * @return string */ public function getJsonName() { return $this->json_name; } /** * Set 'json_name' value * * @param string $value */ public function setJsonName($value = null) { $this->json_name = $value; } /** * Check if 'options' has a value * * @return bool */ public function hasOptions() { return $this->options !== null; } /** * Get 'options' value * * @return \google\protobuf\FieldOptions */ public function getOptions() { return $this->options; } /** * Set 'options' value * * @param \google\protobuf\FieldOptions $value */ public function setOptions(\google\protobuf\FieldOptions $value = null) { $this->options = $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([ 'name' => null, 'number' => null, 'label' => null, 'type' => null, 'type_name' => null, 'extendee' => null, 'default_value' => null, 'oneof_index' => null, 'json_name' => null, 'options' => null ], $values); $message->setName($values['name']); $message->setNumber($values['number']); $message->setLabel($values['label']); $message->setType($values['type']); $message->setTypeName($values['type_name']); $message->setExtendee($values['extendee']); $message->setDefaultValue($values['default_value']); $message->setOneofIndex($values['oneof_index']); $message->setJsonName($values['json_name']); $message->setOptions($values['options']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'FieldDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'number', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 4, 'name' => 'label', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FieldDescriptorProto.Label' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 5, 'name' => 'type', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FieldDescriptorProto.Type' ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'type_name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'extendee', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 7, 'name' => 'default_value', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 9, 'name' => 'oneof_index', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 10, 'name' => 'json_name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 8, 'name' => 'options', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FieldOptions' ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } if ($this->number !== null) { $writer->writeVarint($stream, 24); $writer->writeVarint($stream, $this->number); } if ($this->label !== null) { $writer->writeVarint($stream, 32); $writer->writeVarint($stream, $this->label->value()); } if ($this->type !== null) { $writer->writeVarint($stream, 40); $writer->writeVarint($stream, $this->type->value()); } if ($this->type_name !== null) { $writer->writeVarint($stream, 50); $writer->writeString($stream, $this->type_name); } if ($this->extendee !== null) { $writer->writeVarint($stream, 18); $writer->writeString($stream, $this->extendee); } if ($this->default_value !== null) { $writer->writeVarint($stream, 58); $writer->writeString($stream, $this->default_value); } if ($this->oneof_index !== null) { $writer->writeVarint($stream, 72); $writer->writeVarint($stream, $this->oneof_index); } if ($this->json_name !== null) { $writer->writeVarint($stream, 82); $writer->writeString($stream, $this->json_name); } if ($this->options !== null) { $writer->writeVarint($stream, 66); $writer->writeVarint($stream, $this->options->serializedSize($sizeContext)); $this->options->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, 9); $this->name = $reader->readString($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->number = $reader->readVarint($stream); continue; } if ($tag === 4) { \Protobuf\WireFormat::assertWireType($wire, 14); $this->label = \google\protobuf\FieldDescriptorProto\Label::valueOf($reader->readVarint($stream)); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 14); $this->type = \google\protobuf\FieldDescriptorProto\Type::valueOf($reader->readVarint($stream)); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->type_name = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->extendee = $reader->readString($stream); continue; } if ($tag === 7) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->default_value = $reader->readString($stream); continue; } if ($tag === 9) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->oneof_index = $reader->readVarint($stream); continue; } if ($tag === 10) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->json_name = $reader->readString($stream); continue; } if ($tag === 8) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\FieldOptions(); $this->options = $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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->number !== null) { $size += 1; $size += $calculator->computeVarintSize($this->number); } if ($this->label !== null) { $size += 1; $size += $calculator->computeVarintSize($this->label->value()); } if ($this->type !== null) { $size += 1; $size += $calculator->computeVarintSize($this->type->value()); } if ($this->type_name !== null) { $size += 1; $size += $calculator->computeStringSize($this->type_name); } if ($this->extendee !== null) { $size += 1; $size += $calculator->computeStringSize($this->extendee); } if ($this->default_value !== null) { $size += 1; $size += $calculator->computeStringSize($this->default_value); } if ($this->oneof_index !== null) { $size += 1; $size += $calculator->computeVarintSize($this->oneof_index); } if ($this->json_name !== null) { $size += 1; $size += $calculator->computeStringSize($this->json_name); } if ($this->options !== null) { $innerSize = $this->options->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->name = null; $this->number = null; $this->label = null; $this->type = null; $this->type_name = null; $this->extendee = null; $this->default_value = null; $this->oneof_index = null; $this->json_name = null; $this->options = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\FieldDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; $this->number = ($message->number !== null) ? $message->number : $this->number; $this->label = ($message->label !== null) ? $message->label : $this->label; $this->type = ($message->type !== null) ? $message->type : $this->type; $this->type_name = ($message->type_name !== null) ? $message->type_name : $this->type_name; $this->extendee = ($message->extendee !== null) ? $message->extendee : $this->extendee; $this->default_value = ($message->default_value !== null) ? $message->default_value : $this->default_value; $this->oneof_index = ($message->oneof_index !== null) ? $message->oneof_index : $this->oneof_index; $this->json_name = ($message->json_name !== null) ? $message->json_name : $this->json_name; $this->options = ($message->options !== null) ? $message->options : $this->options; } } Google/Protobuf/FieldOptions.php000066400000044465147735112210012712 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.FieldOptions */ class FieldOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * ctype optional enum = 1 * * @var \google\protobuf\FieldOptions\CType */ protected $ctype = null; /** * packed optional bool = 2 * * @var bool */ protected $packed = null; /** * jstype optional enum = 6 * * @var \google\protobuf\FieldOptions\JSType */ protected $jstype = null; /** * lazy optional bool = 5 * * @var bool */ protected $lazy = null; /** * deprecated optional bool = 3 * * @var bool */ protected $deprecated = null; /** * weak optional bool = 10 * * @var bool */ protected $weak = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->ctype = \google\protobuf\FieldOptions\CType::STRING(); $this->jstype = \google\protobuf\FieldOptions\JSType::JS_NORMAL(); $this->lazy = false; $this->deprecated = false; $this->weak = false; parent::__construct($stream, $configuration); } /** * Check if 'ctype' has a value * * @return bool */ public function hasCtype() { return $this->ctype !== null; } /** * Get 'ctype' value * * @return \google\protobuf\FieldOptions\CType */ public function getCtype() { return $this->ctype; } /** * Set 'ctype' value * * @param \google\protobuf\FieldOptions\CType $value */ public function setCtype(\google\protobuf\FieldOptions\CType $value = null) { $this->ctype = $value; } /** * Check if 'packed' has a value * * @return bool */ public function hasPacked() { return $this->packed !== null; } /** * Get 'packed' value * * @return bool */ public function getPacked() { return $this->packed; } /** * Set 'packed' value * * @param bool $value */ public function setPacked($value = null) { $this->packed = $value; } /** * Check if 'jstype' has a value * * @return bool */ public function hasJstype() { return $this->jstype !== null; } /** * Get 'jstype' value * * @return \google\protobuf\FieldOptions\JSType */ public function getJstype() { return $this->jstype; } /** * Set 'jstype' value * * @param \google\protobuf\FieldOptions\JSType $value */ public function setJstype(\google\protobuf\FieldOptions\JSType $value = null) { $this->jstype = $value; } /** * Check if 'lazy' has a value * * @return bool */ public function hasLazy() { return $this->lazy !== null; } /** * Get 'lazy' value * * @return bool */ public function getLazy() { return $this->lazy; } /** * Set 'lazy' value * * @param bool $value */ public function setLazy($value = null) { $this->lazy = $value; } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'weak' has a value * * @return bool */ public function hasWeak() { return $this->weak !== null; } /** * Get 'weak' value * * @return bool */ public function getWeak() { return $this->weak; } /** * Set 'weak' value * * @param bool $value */ public function setWeak($value = null) { $this->weak = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'ctype' => \google\protobuf\FieldOptions\CType::STRING(), 'packed' => null, 'jstype' => \google\protobuf\FieldOptions\JSType::JS_NORMAL(), 'lazy' => false, 'deprecated' => false, 'weak' => false, 'uninterpreted_option' => [] ], $values); $message->setCtype($values['ctype']); $message->setPacked($values['packed']); $message->setJstype($values['jstype']); $message->setLazy($values['lazy']); $message->setDeprecated($values['deprecated']); $message->setWeak($values['weak']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'FieldOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'ctype', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FieldOptions.CType', 'default_value' => \google\protobuf\FieldOptions\CType::STRING() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'packed', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 6, 'name' => 'jstype', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FieldOptions.JSType', 'default_value' => \google\protobuf\FieldOptions\JSType::JS_NORMAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 5, 'name' => 'lazy', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 3, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 10, 'name' => 'weak', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->ctype !== null) { $writer->writeVarint($stream, 8); $writer->writeVarint($stream, $this->ctype->value()); } if ($this->packed !== null) { $writer->writeVarint($stream, 16); $writer->writeBool($stream, $this->packed); } if ($this->jstype !== null) { $writer->writeVarint($stream, 48); $writer->writeVarint($stream, $this->jstype->value()); } if ($this->lazy !== null) { $writer->writeVarint($stream, 40); $writer->writeBool($stream, $this->lazy); } if ($this->deprecated !== null) { $writer->writeVarint($stream, 24); $writer->writeBool($stream, $this->deprecated); } if ($this->weak !== null) { $writer->writeVarint($stream, 80); $writer->writeBool($stream, $this->weak); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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, 14); $this->ctype = \google\protobuf\FieldOptions\CType::valueOf($reader->readVarint($stream)); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->packed = $reader->readBool($stream); continue; } if ($tag === 6) { \Protobuf\WireFormat::assertWireType($wire, 14); $this->jstype = \google\protobuf\FieldOptions\JSType::valueOf($reader->readVarint($stream)); continue; } if ($tag === 5) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->lazy = $reader->readBool($stream); continue; } if ($tag === 3) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 10) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->weak = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->ctype !== null) { $size += 1; $size += $calculator->computeVarintSize($this->ctype->value()); } if ($this->packed !== null) { $size += 1; $size += 1; } if ($this->jstype !== null) { $size += 1; $size += $calculator->computeVarintSize($this->jstype->value()); } if ($this->lazy !== null) { $size += 1; $size += 1; } if ($this->deprecated !== null) { $size += 1; $size += 1; } if ($this->weak !== null) { $size += 1; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->ctype = \google\protobuf\FieldOptions\CType::STRING(); $this->packed = null; $this->jstype = \google\protobuf\FieldOptions\JSType::JS_NORMAL(); $this->lazy = false; $this->deprecated = false; $this->weak = false; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\FieldOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->ctype = ($message->ctype !== null) ? $message->ctype : $this->ctype; $this->packed = ($message->packed !== null) ? $message->packed : $this->packed; $this->jstype = ($message->jstype !== null) ? $message->jstype : $this->jstype; $this->lazy = ($message->lazy !== null) ? $message->lazy : $this->lazy; $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->weak = ($message->weak !== null) ? $message->weak : $this->weak; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/EnumValueOptions.php000066400000023076147735112210013563 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.EnumValueOptions */ class EnumValueOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * deprecated optional bool = 1 * * @var bool */ protected $deprecated = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->deprecated = false; parent::__construct($stream, $configuration); } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'deprecated' => false, 'uninterpreted_option' => [] ], $values); $message->setDeprecated($values['deprecated']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'EnumValueOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->deprecated !== null) { $writer->writeVarint($stream, 8); $writer->writeBool($stream, $this->deprecated); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->deprecated !== null) { $size += 1; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->deprecated = false; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\EnumValueOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/OneofDescriptorProto.php000066400000013551147735112210014434 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.OneofDescriptorProto */ class OneofDescriptorProto extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name optional string = 1 * * @var string */ protected $name = null; /** * Check if 'name' has a value * * @return bool */ public function hasName() { return $this->name !== null; } /** * Get 'name' value * * @return string */ public function getName() { return $this->name; } /** * Set 'name' value * * @param string $value */ public function setName($value = null) { $this->name = $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([ 'name' => null ], $values); $message->setName($values['name']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'OneofDescriptorProto', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), ], ]); } /** * {@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->name !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name); } 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, 9); $this->name = $reader->readString($stream); 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->name !== null) { $size += 1; $size += $calculator->computeStringSize($this->name); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\OneofDescriptorProto) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name = ($message->name !== null) ? $message->name : $this->name; } } Google/Protobuf/DescriptorProto/ExtensionRange.php000066400000016612147735112210016377 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\DescriptorProto; /** * Protobuf message : google.protobuf.DescriptorProto.ExtensionRange */ class ExtensionRange extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * start optional int32 = 1 * * @var int */ protected $start = null; /** * end optional int32 = 2 * * @var int */ protected $end = null; /** * Check if 'start' has a value * * @return bool */ public function hasStart() { return $this->start !== null; } /** * Get 'start' value * * @return int */ public function getStart() { return $this->start; } /** * Set 'start' value * * @param int $value */ public function setStart($value = null) { $this->start = $value; } /** * Check if 'end' has a value * * @return bool */ public function hasEnd() { return $this->end !== null; } /** * Get 'end' value * * @return int */ public function getEnd() { return $this->end; } /** * Set 'end' value * * @param int $value */ public function setEnd($value = null) { $this->end = $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([ 'start' => null, 'end' => null ], $values); $message->setStart($values['start']); $message->setEnd($values['end']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'ExtensionRange', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'start', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'end', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), ], ]); } /** * {@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->start !== null) { $writer->writeVarint($stream, 8); $writer->writeVarint($stream, $this->start); } if ($this->end !== null) { $writer->writeVarint($stream, 16); $writer->writeVarint($stream, $this->end); } 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, 5); $this->start = $reader->readVarint($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->end = $reader->readVarint($stream); 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->start !== null) { $size += 1; $size += $calculator->computeVarintSize($this->start); } if ($this->end !== null) { $size += 1; $size += $calculator->computeVarintSize($this->end); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->start = null; $this->end = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\DescriptorProto\ExtensionRange) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->start = ($message->start !== null) ? $message->start : $this->start; $this->end = ($message->end !== null) ? $message->end : $this->end; } } Google/Protobuf/DescriptorProto/ReservedRange.php000066400000016606147735112210016205 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\DescriptorProto; /** * Protobuf message : google.protobuf.DescriptorProto.ReservedRange */ class ReservedRange extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * start optional int32 = 1 * * @var int */ protected $start = null; /** * end optional int32 = 2 * * @var int */ protected $end = null; /** * Check if 'start' has a value * * @return bool */ public function hasStart() { return $this->start !== null; } /** * Get 'start' value * * @return int */ public function getStart() { return $this->start; } /** * Set 'start' value * * @param int $value */ public function setStart($value = null) { $this->start = $value; } /** * Check if 'end' has a value * * @return bool */ public function hasEnd() { return $this->end !== null; } /** * Get 'end' value * * @return int */ public function getEnd() { return $this->end; } /** * Set 'end' value * * @param int $value */ public function setEnd($value = null) { $this->end = $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([ 'start' => null, 'end' => null ], $values); $message->setStart($values['start']); $message->setEnd($values['end']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'ReservedRange', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'start', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'end', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), ], ]); } /** * {@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->start !== null) { $writer->writeVarint($stream, 8); $writer->writeVarint($stream, $this->start); } if ($this->end !== null) { $writer->writeVarint($stream, 16); $writer->writeVarint($stream, $this->end); } 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, 5); $this->start = $reader->readVarint($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 5); $this->end = $reader->readVarint($stream); 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->start !== null) { $size += 1; $size += $calculator->computeVarintSize($this->start); } if ($this->end !== null) { $size += 1; $size += $calculator->computeVarintSize($this->end); } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->start = null; $this->end = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\DescriptorProto\ReservedRange) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->start = ($message->start !== null) ? $message->start : $this->start; $this->end = ($message->end !== null) ? $message->end : $this->end; } } Google/Protobuf/UninterpretedOption/NamePart.php000066400000020472147735112210016033 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\UninterpretedOption; /** * Protobuf message : google.protobuf.UninterpretedOption.NamePart */ class NamePart extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * name_part required string = 1 * * @var string */ protected $name_part = null; /** * is_extension required bool = 2 * * @var bool */ protected $is_extension = null; /** * Check if 'name_part' has a value * * @return bool */ public function hasNamePart() { return $this->name_part !== null; } /** * Get 'name_part' value * * @return string */ public function getNamePart() { return $this->name_part; } /** * Set 'name_part' value * * @param string $value */ public function setNamePart($value) { $this->name_part = $value; } /** * Check if 'is_extension' has a value * * @return bool */ public function hasIsExtension() { return $this->is_extension !== null; } /** * Get 'is_extension' value * * @return bool */ public function getIsExtension() { return $this->is_extension; } /** * Set 'is_extension' value * * @param bool $value */ public function setIsExtension($value) { $this->is_extension = $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) { if ( ! isset($values['name_part'])) { throw new \InvalidArgumentException('Field "name_part" (tag 1) is required but has no value.'); } if ( ! isset($values['is_extension'])) { throw new \InvalidArgumentException('Field "is_extension" (tag 2) is required but has no value.'); } $message = new self(); $values = array_merge([ ], $values); $message->setNamePart($values['name_part']); $message->setIsExtension($values['is_extension']); return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'NamePart', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'name_part', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REQUIRED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 2, 'name' => 'is_extension', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REQUIRED() ]), ], ]); } /** * {@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->name_part === null) { throw new \UnexpectedValueException('Field "\\google\\protobuf\\UninterpretedOption\\NamePart#name_part" (tag 1) is required but has no value.'); } if ($this->is_extension === null) { throw new \UnexpectedValueException('Field "\\google\\protobuf\\UninterpretedOption\\NamePart#is_extension" (tag 2) is required but has no value.'); } if ($this->name_part !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->name_part); } if ($this->is_extension !== null) { $writer->writeVarint($stream, 16); $writer->writeBool($stream, $this->is_extension); } 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, 9); $this->name_part = $reader->readString($stream); continue; } if ($tag === 2) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->is_extension = $reader->readBool($stream); 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->name_part !== null) { $size += 1; $size += $calculator->computeStringSize($this->name_part); } if ($this->is_extension !== null) { $size += 1; $size += 1; } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->name_part = null; $this->is_extension = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\UninterpretedOption\NamePart) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->name_part = ($message->name_part !== null) ? $message->name_part : $this->name_part; $this->is_extension = ($message->is_extension !== null) ? $message->is_extension : $this->is_extension; } } Google/Protobuf/FileOptions.php000066400000111117147735112210012533 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.FileOptions */ class FileOptions extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * java_package optional string = 1 * * @var string */ protected $java_package = null; /** * java_outer_classname optional string = 8 * * @var string */ protected $java_outer_classname = null; /** * java_multiple_files optional bool = 10 * * @var bool */ protected $java_multiple_files = null; /** * java_generate_equals_and_hash optional bool = 20 * * @var bool */ protected $java_generate_equals_and_hash = null; /** * java_string_check_utf8 optional bool = 27 * * @var bool */ protected $java_string_check_utf8 = null; /** * optimize_for optional enum = 9 * * @var \google\protobuf\FileOptions\OptimizeMode */ protected $optimize_for = null; /** * go_package optional string = 11 * * @var string */ protected $go_package = null; /** * cc_generic_services optional bool = 16 * * @var bool */ protected $cc_generic_services = null; /** * java_generic_services optional bool = 17 * * @var bool */ protected $java_generic_services = null; /** * py_generic_services optional bool = 18 * * @var bool */ protected $py_generic_services = null; /** * deprecated optional bool = 23 * * @var bool */ protected $deprecated = null; /** * cc_enable_arenas optional bool = 31 * * @var bool */ protected $cc_enable_arenas = null; /** * objc_class_prefix optional string = 36 * * @var string */ protected $objc_class_prefix = null; /** * csharp_namespace optional string = 37 * * @var string */ protected $csharp_namespace = null; /** * javanano_use_deprecated_package optional bool = 38 * * @var bool */ protected $javanano_use_deprecated_package = null; /** * uninterpreted_option repeated message = 999 * * @var \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ protected $uninterpreted_option = null; /** * {@inheritdoc} */ public function __construct($stream = null, \Protobuf\Configuration $configuration = null) { $this->java_multiple_files = false; $this->java_generate_equals_and_hash = false; $this->java_string_check_utf8 = false; $this->optimize_for = \google\protobuf\FileOptions\OptimizeMode::SPEED(); $this->cc_generic_services = false; $this->java_generic_services = false; $this->py_generic_services = false; $this->deprecated = false; $this->cc_enable_arenas = false; parent::__construct($stream, $configuration); } /** * Check if 'java_package' has a value * * @return bool */ public function hasJavaPackage() { return $this->java_package !== null; } /** * Get 'java_package' value * * @return string */ public function getJavaPackage() { return $this->java_package; } /** * Set 'java_package' value * * @param string $value */ public function setJavaPackage($value = null) { $this->java_package = $value; } /** * Check if 'java_outer_classname' has a value * * @return bool */ public function hasJavaOuterClassname() { return $this->java_outer_classname !== null; } /** * Get 'java_outer_classname' value * * @return string */ public function getJavaOuterClassname() { return $this->java_outer_classname; } /** * Set 'java_outer_classname' value * * @param string $value */ public function setJavaOuterClassname($value = null) { $this->java_outer_classname = $value; } /** * Check if 'java_multiple_files' has a value * * @return bool */ public function hasJavaMultipleFiles() { return $this->java_multiple_files !== null; } /** * Get 'java_multiple_files' value * * @return bool */ public function getJavaMultipleFiles() { return $this->java_multiple_files; } /** * Set 'java_multiple_files' value * * @param bool $value */ public function setJavaMultipleFiles($value = null) { $this->java_multiple_files = $value; } /** * Check if 'java_generate_equals_and_hash' has a value * * @return bool */ public function hasJavaGenerateEqualsAndHash() { return $this->java_generate_equals_and_hash !== null; } /** * Get 'java_generate_equals_and_hash' value * * @return bool */ public function getJavaGenerateEqualsAndHash() { return $this->java_generate_equals_and_hash; } /** * Set 'java_generate_equals_and_hash' value * * @param bool $value */ public function setJavaGenerateEqualsAndHash($value = null) { $this->java_generate_equals_and_hash = $value; } /** * Check if 'java_string_check_utf8' has a value * * @return bool */ public function hasJavaStringCheckUtf8() { return $this->java_string_check_utf8 !== null; } /** * Get 'java_string_check_utf8' value * * @return bool */ public function getJavaStringCheckUtf8() { return $this->java_string_check_utf8; } /** * Set 'java_string_check_utf8' value * * @param bool $value */ public function setJavaStringCheckUtf8($value = null) { $this->java_string_check_utf8 = $value; } /** * Check if 'optimize_for' has a value * * @return bool */ public function hasOptimizeFor() { return $this->optimize_for !== null; } /** * Get 'optimize_for' value * * @return \google\protobuf\FileOptions\OptimizeMode */ public function getOptimizeFor() { return $this->optimize_for; } /** * Set 'optimize_for' value * * @param \google\protobuf\FileOptions\OptimizeMode $value */ public function setOptimizeFor(\google\protobuf\FileOptions\OptimizeMode $value = null) { $this->optimize_for = $value; } /** * Check if 'go_package' has a value * * @return bool */ public function hasGoPackage() { return $this->go_package !== null; } /** * Get 'go_package' value * * @return string */ public function getGoPackage() { return $this->go_package; } /** * Set 'go_package' value * * @param string $value */ public function setGoPackage($value = null) { $this->go_package = $value; } /** * Check if 'cc_generic_services' has a value * * @return bool */ public function hasCcGenericServices() { return $this->cc_generic_services !== null; } /** * Get 'cc_generic_services' value * * @return bool */ public function getCcGenericServices() { return $this->cc_generic_services; } /** * Set 'cc_generic_services' value * * @param bool $value */ public function setCcGenericServices($value = null) { $this->cc_generic_services = $value; } /** * Check if 'java_generic_services' has a value * * @return bool */ public function hasJavaGenericServices() { return $this->java_generic_services !== null; } /** * Get 'java_generic_services' value * * @return bool */ public function getJavaGenericServices() { return $this->java_generic_services; } /** * Set 'java_generic_services' value * * @param bool $value */ public function setJavaGenericServices($value = null) { $this->java_generic_services = $value; } /** * Check if 'py_generic_services' has a value * * @return bool */ public function hasPyGenericServices() { return $this->py_generic_services !== null; } /** * Get 'py_generic_services' value * * @return bool */ public function getPyGenericServices() { return $this->py_generic_services; } /** * Set 'py_generic_services' value * * @param bool $value */ public function setPyGenericServices($value = null) { $this->py_generic_services = $value; } /** * Check if 'deprecated' has a value * * @return bool */ public function hasDeprecated() { return $this->deprecated !== null; } /** * Get 'deprecated' value * * @return bool */ public function getDeprecated() { return $this->deprecated; } /** * Set 'deprecated' value * * @param bool $value */ public function setDeprecated($value = null) { $this->deprecated = $value; } /** * Check if 'cc_enable_arenas' has a value * * @return bool */ public function hasCcEnableArenas() { return $this->cc_enable_arenas !== null; } /** * Get 'cc_enable_arenas' value * * @return bool */ public function getCcEnableArenas() { return $this->cc_enable_arenas; } /** * Set 'cc_enable_arenas' value * * @param bool $value */ public function setCcEnableArenas($value = null) { $this->cc_enable_arenas = $value; } /** * Check if 'objc_class_prefix' has a value * * @return bool */ public function hasObjcClassPrefix() { return $this->objc_class_prefix !== null; } /** * Get 'objc_class_prefix' value * * @return string */ public function getObjcClassPrefix() { return $this->objc_class_prefix; } /** * Set 'objc_class_prefix' value * * @param string $value */ public function setObjcClassPrefix($value = null) { $this->objc_class_prefix = $value; } /** * Check if 'csharp_namespace' has a value * * @return bool */ public function hasCsharpNamespace() { return $this->csharp_namespace !== null; } /** * Get 'csharp_namespace' value * * @return string */ public function getCsharpNamespace() { return $this->csharp_namespace; } /** * Set 'csharp_namespace' value * * @param string $value */ public function setCsharpNamespace($value = null) { $this->csharp_namespace = $value; } /** * Check if 'javanano_use_deprecated_package' has a value * * @return bool */ public function hasJavananoUseDeprecatedPackage() { return $this->javanano_use_deprecated_package !== null; } /** * Get 'javanano_use_deprecated_package' value * * @return bool */ public function getJavananoUseDeprecatedPackage() { return $this->javanano_use_deprecated_package; } /** * Set 'javanano_use_deprecated_package' value * * @param bool $value */ public function setJavananoUseDeprecatedPackage($value = null) { $this->javanano_use_deprecated_package = $value; } /** * Check if 'uninterpreted_option' has a value * * @return bool */ public function hasUninterpretedOptionList() { return $this->uninterpreted_option !== null; } /** * Get 'uninterpreted_option' value * * @return \Protobuf\Collection<\google\protobuf\UninterpretedOption> */ public function getUninterpretedOptionList() { return $this->uninterpreted_option; } /** * Set 'uninterpreted_option' value * * @param \Protobuf\Collection<\google\protobuf\UninterpretedOption> $value */ public function setUninterpretedOptionList(\Protobuf\Collection $value = null) { $this->uninterpreted_option = $value; } /** * Add a new element to 'uninterpreted_option' * * @param \google\protobuf\UninterpretedOption $value */ public function addUninterpretedOption(\google\protobuf\UninterpretedOption $value) { if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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([ 'java_package' => null, 'java_outer_classname' => null, 'java_multiple_files' => false, 'java_generate_equals_and_hash' => false, 'java_string_check_utf8' => false, 'optimize_for' => \google\protobuf\FileOptions\OptimizeMode::SPEED(), 'go_package' => null, 'cc_generic_services' => false, 'java_generic_services' => false, 'py_generic_services' => false, 'deprecated' => false, 'cc_enable_arenas' => false, 'objc_class_prefix' => null, 'csharp_namespace' => null, 'javanano_use_deprecated_package' => null, 'uninterpreted_option' => [] ], $values); $message->setJavaPackage($values['java_package']); $message->setJavaOuterClassname($values['java_outer_classname']); $message->setJavaMultipleFiles($values['java_multiple_files']); $message->setJavaGenerateEqualsAndHash($values['java_generate_equals_and_hash']); $message->setJavaStringCheckUtf8($values['java_string_check_utf8']); $message->setOptimizeFor($values['optimize_for']); $message->setGoPackage($values['go_package']); $message->setCcGenericServices($values['cc_generic_services']); $message->setJavaGenericServices($values['java_generic_services']); $message->setPyGenericServices($values['py_generic_services']); $message->setDeprecated($values['deprecated']); $message->setCcEnableArenas($values['cc_enable_arenas']); $message->setObjcClassPrefix($values['objc_class_prefix']); $message->setCsharpNamespace($values['csharp_namespace']); $message->setJavananoUseDeprecatedPackage($values['javanano_use_deprecated_package']); foreach ($values['uninterpreted_option'] as $item) { $message->addUninterpretedOption($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'FileOptions', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'java_package', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 8, 'name' => 'java_outer_classname', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 10, 'name' => 'java_multiple_files', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 20, 'name' => 'java_generate_equals_and_hash', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 27, 'name' => 'java_string_check_utf8', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 9, 'name' => 'optimize_for', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'type_name' => '.google.protobuf.FileOptions.OptimizeMode', 'default_value' => \google\protobuf\FileOptions\OptimizeMode::SPEED() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 11, 'name' => 'go_package', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 16, 'name' => 'cc_generic_services', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 17, 'name' => 'java_generic_services', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 18, 'name' => 'py_generic_services', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 23, 'name' => 'deprecated', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 31, 'name' => 'cc_enable_arenas', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(), 'default_value' => false ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 36, 'name' => 'objc_class_prefix', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 37, 'name' => 'csharp_namespace', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 38, 'name' => 'javanano_use_deprecated_package', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL() ]), \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 999, 'name' => 'uninterpreted_option', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.UninterpretedOption' ]), ], ]); } /** * {@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->java_package !== null) { $writer->writeVarint($stream, 10); $writer->writeString($stream, $this->java_package); } if ($this->java_outer_classname !== null) { $writer->writeVarint($stream, 66); $writer->writeString($stream, $this->java_outer_classname); } if ($this->java_multiple_files !== null) { $writer->writeVarint($stream, 80); $writer->writeBool($stream, $this->java_multiple_files); } if ($this->java_generate_equals_and_hash !== null) { $writer->writeVarint($stream, 160); $writer->writeBool($stream, $this->java_generate_equals_and_hash); } if ($this->java_string_check_utf8 !== null) { $writer->writeVarint($stream, 216); $writer->writeBool($stream, $this->java_string_check_utf8); } if ($this->optimize_for !== null) { $writer->writeVarint($stream, 72); $writer->writeVarint($stream, $this->optimize_for->value()); } if ($this->go_package !== null) { $writer->writeVarint($stream, 90); $writer->writeString($stream, $this->go_package); } if ($this->cc_generic_services !== null) { $writer->writeVarint($stream, 128); $writer->writeBool($stream, $this->cc_generic_services); } if ($this->java_generic_services !== null) { $writer->writeVarint($stream, 136); $writer->writeBool($stream, $this->java_generic_services); } if ($this->py_generic_services !== null) { $writer->writeVarint($stream, 144); $writer->writeBool($stream, $this->py_generic_services); } if ($this->deprecated !== null) { $writer->writeVarint($stream, 184); $writer->writeBool($stream, $this->deprecated); } if ($this->cc_enable_arenas !== null) { $writer->writeVarint($stream, 248); $writer->writeBool($stream, $this->cc_enable_arenas); } if ($this->objc_class_prefix !== null) { $writer->writeVarint($stream, 290); $writer->writeString($stream, $this->objc_class_prefix); } if ($this->csharp_namespace !== null) { $writer->writeVarint($stream, 298); $writer->writeString($stream, $this->csharp_namespace); } if ($this->javanano_use_deprecated_package !== null) { $writer->writeVarint($stream, 304); $writer->writeBool($stream, $this->javanano_use_deprecated_package); } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $writer->writeVarint($stream, 7994); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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, 9); $this->java_package = $reader->readString($stream); continue; } if ($tag === 8) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->java_outer_classname = $reader->readString($stream); continue; } if ($tag === 10) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->java_multiple_files = $reader->readBool($stream); continue; } if ($tag === 20) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->java_generate_equals_and_hash = $reader->readBool($stream); continue; } if ($tag === 27) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->java_string_check_utf8 = $reader->readBool($stream); continue; } if ($tag === 9) { \Protobuf\WireFormat::assertWireType($wire, 14); $this->optimize_for = \google\protobuf\FileOptions\OptimizeMode::valueOf($reader->readVarint($stream)); continue; } if ($tag === 11) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->go_package = $reader->readString($stream); continue; } if ($tag === 16) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->cc_generic_services = $reader->readBool($stream); continue; } if ($tag === 17) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->java_generic_services = $reader->readBool($stream); continue; } if ($tag === 18) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->py_generic_services = $reader->readBool($stream); continue; } if ($tag === 23) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->deprecated = $reader->readBool($stream); continue; } if ($tag === 31) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->cc_enable_arenas = $reader->readBool($stream); continue; } if ($tag === 36) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->objc_class_prefix = $reader->readString($stream); continue; } if ($tag === 37) { \Protobuf\WireFormat::assertWireType($wire, 9); $this->csharp_namespace = $reader->readString($stream); continue; } if ($tag === 38) { \Protobuf\WireFormat::assertWireType($wire, 8); $this->javanano_use_deprecated_package = $reader->readBool($stream); continue; } if ($tag === 999) { \Protobuf\WireFormat::assertWireType($wire, 11); $innerSize = $reader->readVarint($stream); $innerMessage = new \google\protobuf\UninterpretedOption(); if ($this->uninterpreted_option === null) { $this->uninterpreted_option = new \Protobuf\MessageCollection(); } $this->uninterpreted_option->add($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->java_package !== null) { $size += 1; $size += $calculator->computeStringSize($this->java_package); } if ($this->java_outer_classname !== null) { $size += 1; $size += $calculator->computeStringSize($this->java_outer_classname); } if ($this->java_multiple_files !== null) { $size += 1; $size += 1; } if ($this->java_generate_equals_and_hash !== null) { $size += 2; $size += 1; } if ($this->java_string_check_utf8 !== null) { $size += 2; $size += 1; } if ($this->optimize_for !== null) { $size += 1; $size += $calculator->computeVarintSize($this->optimize_for->value()); } if ($this->go_package !== null) { $size += 1; $size += $calculator->computeStringSize($this->go_package); } if ($this->cc_generic_services !== null) { $size += 2; $size += 1; } if ($this->java_generic_services !== null) { $size += 2; $size += 1; } if ($this->py_generic_services !== null) { $size += 2; $size += 1; } if ($this->deprecated !== null) { $size += 2; $size += 1; } if ($this->cc_enable_arenas !== null) { $size += 2; $size += 1; } if ($this->objc_class_prefix !== null) { $size += 2; $size += $calculator->computeStringSize($this->objc_class_prefix); } if ($this->csharp_namespace !== null) { $size += 2; $size += $calculator->computeStringSize($this->csharp_namespace); } if ($this->javanano_use_deprecated_package !== null) { $size += 2; $size += 1; } if ($this->uninterpreted_option !== null) { foreach ($this->uninterpreted_option as $val) { $innerSize = $val->serializedSize($context); $size += 2; $size += $innerSize; $size += $calculator->computeVarintSize($innerSize); } } if ($this->extensions !== null) { $size += $this->extensions->serializedSize($context); } return $size; } /** * {@inheritdoc} */ public function clear() { $this->java_package = null; $this->java_outer_classname = null; $this->java_multiple_files = false; $this->java_generate_equals_and_hash = false; $this->java_string_check_utf8 = false; $this->optimize_for = \google\protobuf\FileOptions\OptimizeMode::SPEED(); $this->go_package = null; $this->cc_generic_services = false; $this->java_generic_services = false; $this->py_generic_services = false; $this->deprecated = false; $this->cc_enable_arenas = false; $this->objc_class_prefix = null; $this->csharp_namespace = null; $this->javanano_use_deprecated_package = null; $this->uninterpreted_option = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\FileOptions) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->java_package = ($message->java_package !== null) ? $message->java_package : $this->java_package; $this->java_outer_classname = ($message->java_outer_classname !== null) ? $message->java_outer_classname : $this->java_outer_classname; $this->java_multiple_files = ($message->java_multiple_files !== null) ? $message->java_multiple_files : $this->java_multiple_files; $this->java_generate_equals_and_hash = ($message->java_generate_equals_and_hash !== null) ? $message->java_generate_equals_and_hash : $this->java_generate_equals_and_hash; $this->java_string_check_utf8 = ($message->java_string_check_utf8 !== null) ? $message->java_string_check_utf8 : $this->java_string_check_utf8; $this->optimize_for = ($message->optimize_for !== null) ? $message->optimize_for : $this->optimize_for; $this->go_package = ($message->go_package !== null) ? $message->go_package : $this->go_package; $this->cc_generic_services = ($message->cc_generic_services !== null) ? $message->cc_generic_services : $this->cc_generic_services; $this->java_generic_services = ($message->java_generic_services !== null) ? $message->java_generic_services : $this->java_generic_services; $this->py_generic_services = ($message->py_generic_services !== null) ? $message->py_generic_services : $this->py_generic_services; $this->deprecated = ($message->deprecated !== null) ? $message->deprecated : $this->deprecated; $this->cc_enable_arenas = ($message->cc_enable_arenas !== null) ? $message->cc_enable_arenas : $this->cc_enable_arenas; $this->objc_class_prefix = ($message->objc_class_prefix !== null) ? $message->objc_class_prefix : $this->objc_class_prefix; $this->csharp_namespace = ($message->csharp_namespace !== null) ? $message->csharp_namespace : $this->csharp_namespace; $this->javanano_use_deprecated_package = ($message->javanano_use_deprecated_package !== null) ? $message->javanano_use_deprecated_package : $this->javanano_use_deprecated_package; $this->uninterpreted_option = ($message->uninterpreted_option !== null) ? $message->uninterpreted_option : $this->uninterpreted_option; } } Google/Protobuf/FieldDescriptorProto/Label.php000066400000004236147735112210015430 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\FieldDescriptorProto; /** * Protobuf enum : google.protobuf.FieldDescriptorProto.Label */ class Label extends \Protobuf\Enum { /** * LABEL_OPTIONAL = 1 */ const LABEL_OPTIONAL_VALUE = 1; /** * LABEL_REQUIRED = 2 */ const LABEL_REQUIRED_VALUE = 2; /** * LABEL_REPEATED = 3 */ const LABEL_REPEATED_VALUE = 3; /** * @var \google\protobuf\FieldDescriptorProto\Label */ protected static $LABEL_OPTIONAL = null; /** * @var \google\protobuf\FieldDescriptorProto\Label */ protected static $LABEL_REQUIRED = null; /** * @var \google\protobuf\FieldDescriptorProto\Label */ protected static $LABEL_REPEATED = null; /** * @return \google\protobuf\FieldDescriptorProto\Label */ public static function LABEL_OPTIONAL() { if (self::$LABEL_OPTIONAL !== null) { return self::$LABEL_OPTIONAL; } return self::$LABEL_OPTIONAL = new self('LABEL_OPTIONAL', self::LABEL_OPTIONAL_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Label */ public static function LABEL_REQUIRED() { if (self::$LABEL_REQUIRED !== null) { return self::$LABEL_REQUIRED; } return self::$LABEL_REQUIRED = new self('LABEL_REQUIRED', self::LABEL_REQUIRED_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Label */ public static function LABEL_REPEATED() { if (self::$LABEL_REPEATED !== null) { return self::$LABEL_REPEATED; } return self::$LABEL_REPEATED = new self('LABEL_REPEATED', self::LABEL_REPEATED_VALUE); } /** * @param int $value * @return \google\protobuf\FieldDescriptorProto\Label */ public static function valueOf($value) { switch ($value) { case 1: return self::LABEL_OPTIONAL(); case 2: return self::LABEL_REQUIRED(); case 3: return self::LABEL_REPEATED(); default: return null; } } } Google/Protobuf/FieldDescriptorProto/Type.php000066400000024004147735112210015325 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf\FieldDescriptorProto; /** * Protobuf enum : google.protobuf.FieldDescriptorProto.Type */ class Type extends \Protobuf\Enum { /** * TYPE_DOUBLE = 1 */ const TYPE_DOUBLE_VALUE = 1; /** * TYPE_FLOAT = 2 */ const TYPE_FLOAT_VALUE = 2; /** * TYPE_INT64 = 3 */ const TYPE_INT64_VALUE = 3; /** * TYPE_UINT64 = 4 */ const TYPE_UINT64_VALUE = 4; /** * TYPE_INT32 = 5 */ const TYPE_INT32_VALUE = 5; /** * TYPE_FIXED64 = 6 */ const TYPE_FIXED64_VALUE = 6; /** * TYPE_FIXED32 = 7 */ const TYPE_FIXED32_VALUE = 7; /** * TYPE_BOOL = 8 */ const TYPE_BOOL_VALUE = 8; /** * TYPE_STRING = 9 */ const TYPE_STRING_VALUE = 9; /** * TYPE_GROUP = 10 */ const TYPE_GROUP_VALUE = 10; /** * TYPE_MESSAGE = 11 */ const TYPE_MESSAGE_VALUE = 11; /** * TYPE_BYTES = 12 */ const TYPE_BYTES_VALUE = 12; /** * TYPE_UINT32 = 13 */ const TYPE_UINT32_VALUE = 13; /** * TYPE_ENUM = 14 */ const TYPE_ENUM_VALUE = 14; /** * TYPE_SFIXED32 = 15 */ const TYPE_SFIXED32_VALUE = 15; /** * TYPE_SFIXED64 = 16 */ const TYPE_SFIXED64_VALUE = 16; /** * TYPE_SINT32 = 17 */ const TYPE_SINT32_VALUE = 17; /** * TYPE_SINT64 = 18 */ const TYPE_SINT64_VALUE = 18; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_DOUBLE = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_FLOAT = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_INT64 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_UINT64 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_INT32 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_FIXED64 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_FIXED32 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_BOOL = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_STRING = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_GROUP = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_MESSAGE = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_BYTES = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_UINT32 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_ENUM = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_SFIXED32 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_SFIXED64 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_SINT32 = null; /** * @var \google\protobuf\FieldDescriptorProto\Type */ protected static $TYPE_SINT64 = null; /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_DOUBLE() { if (self::$TYPE_DOUBLE !== null) { return self::$TYPE_DOUBLE; } return self::$TYPE_DOUBLE = new self('TYPE_DOUBLE', self::TYPE_DOUBLE_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_FLOAT() { if (self::$TYPE_FLOAT !== null) { return self::$TYPE_FLOAT; } return self::$TYPE_FLOAT = new self('TYPE_FLOAT', self::TYPE_FLOAT_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_INT64() { if (self::$TYPE_INT64 !== null) { return self::$TYPE_INT64; } return self::$TYPE_INT64 = new self('TYPE_INT64', self::TYPE_INT64_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_UINT64() { if (self::$TYPE_UINT64 !== null) { return self::$TYPE_UINT64; } return self::$TYPE_UINT64 = new self('TYPE_UINT64', self::TYPE_UINT64_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_INT32() { if (self::$TYPE_INT32 !== null) { return self::$TYPE_INT32; } return self::$TYPE_INT32 = new self('TYPE_INT32', self::TYPE_INT32_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_FIXED64() { if (self::$TYPE_FIXED64 !== null) { return self::$TYPE_FIXED64; } return self::$TYPE_FIXED64 = new self('TYPE_FIXED64', self::TYPE_FIXED64_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_FIXED32() { if (self::$TYPE_FIXED32 !== null) { return self::$TYPE_FIXED32; } return self::$TYPE_FIXED32 = new self('TYPE_FIXED32', self::TYPE_FIXED32_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_BOOL() { if (self::$TYPE_BOOL !== null) { return self::$TYPE_BOOL; } return self::$TYPE_BOOL = new self('TYPE_BOOL', self::TYPE_BOOL_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_STRING() { if (self::$TYPE_STRING !== null) { return self::$TYPE_STRING; } return self::$TYPE_STRING = new self('TYPE_STRING', self::TYPE_STRING_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_GROUP() { if (self::$TYPE_GROUP !== null) { return self::$TYPE_GROUP; } return self::$TYPE_GROUP = new self('TYPE_GROUP', self::TYPE_GROUP_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_MESSAGE() { if (self::$TYPE_MESSAGE !== null) { return self::$TYPE_MESSAGE; } return self::$TYPE_MESSAGE = new self('TYPE_MESSAGE', self::TYPE_MESSAGE_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_BYTES() { if (self::$TYPE_BYTES !== null) { return self::$TYPE_BYTES; } return self::$TYPE_BYTES = new self('TYPE_BYTES', self::TYPE_BYTES_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_UINT32() { if (self::$TYPE_UINT32 !== null) { return self::$TYPE_UINT32; } return self::$TYPE_UINT32 = new self('TYPE_UINT32', self::TYPE_UINT32_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_ENUM() { if (self::$TYPE_ENUM !== null) { return self::$TYPE_ENUM; } return self::$TYPE_ENUM = new self('TYPE_ENUM', self::TYPE_ENUM_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_SFIXED32() { if (self::$TYPE_SFIXED32 !== null) { return self::$TYPE_SFIXED32; } return self::$TYPE_SFIXED32 = new self('TYPE_SFIXED32', self::TYPE_SFIXED32_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_SFIXED64() { if (self::$TYPE_SFIXED64 !== null) { return self::$TYPE_SFIXED64; } return self::$TYPE_SFIXED64 = new self('TYPE_SFIXED64', self::TYPE_SFIXED64_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_SINT32() { if (self::$TYPE_SINT32 !== null) { return self::$TYPE_SINT32; } return self::$TYPE_SINT32 = new self('TYPE_SINT32', self::TYPE_SINT32_VALUE); } /** * @return \google\protobuf\FieldDescriptorProto\Type */ public static function TYPE_SINT64() { if (self::$TYPE_SINT64 !== null) { return self::$TYPE_SINT64; } return self::$TYPE_SINT64 = new self('TYPE_SINT64', self::TYPE_SINT64_VALUE); } /** * @param int $value * @return \google\protobuf\FieldDescriptorProto\Type */ public static function valueOf($value) { switch ($value) { case 1: return self::TYPE_DOUBLE(); case 2: return self::TYPE_FLOAT(); case 3: return self::TYPE_INT64(); case 4: return self::TYPE_UINT64(); case 5: return self::TYPE_INT32(); case 6: return self::TYPE_FIXED64(); case 7: return self::TYPE_FIXED32(); case 8: return self::TYPE_BOOL(); case 9: return self::TYPE_STRING(); case 10: return self::TYPE_GROUP(); case 11: return self::TYPE_MESSAGE(); case 12: return self::TYPE_BYTES(); case 13: return self::TYPE_UINT32(); case 14: return self::TYPE_ENUM(); case 15: return self::TYPE_SFIXED32(); case 16: return self::TYPE_SFIXED64(); case 17: return self::TYPE_SINT32(); case 18: return self::TYPE_SINT64(); default: return null; } } } Google/Protobuf/SourceCodeInfo.php000066400000016474147735112210013161 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.SourceCodeInfo */ class SourceCodeInfo extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * location repeated message = 1 * * @var \Protobuf\Collection<\google\protobuf\SourceCodeInfo\Location> */ protected $location = null; /** * Check if 'location' has a value * * @return bool */ public function hasLocationList() { return $this->location !== null; } /** * Get 'location' value * * @return \Protobuf\Collection<\google\protobuf\SourceCodeInfo\Location> */ public function getLocationList() { return $this->location; } /** * Set 'location' value * * @param \Protobuf\Collection<\google\protobuf\SourceCodeInfo\Location> $value */ public function setLocationList(\Protobuf\Collection $value = null) { $this->location = $value; } /** * Add a new element to 'location' * * @param \google\protobuf\SourceCodeInfo\Location $value */ public function addLocation(\google\protobuf\SourceCodeInfo\Location $value) { if ($this->location === null) { $this->location = new \Protobuf\MessageCollection(); } $this->location->add($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([ 'location' => [] ], $values); foreach ($values['location'] as $item) { $message->addLocation($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'SourceCodeInfo', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'location', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.SourceCodeInfo.Location' ]), ], ]); } /** * {@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->location !== null) { foreach ($this->location as $val) { $writer->writeVarint($stream, 10); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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 \google\protobuf\SourceCodeInfo\Location(); if ($this->location === null) { $this->location = new \Protobuf\MessageCollection(); } $this->location->add($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->location !== null) { foreach ($this->location as $val) { $innerSize = $val->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->location = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\SourceCodeInfo) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->location = ($message->location !== null) ? $message->location : $this->location; } } Google/Protobuf/FileDescriptorSet.php000066400000016254147735112210013700 0ustar00<?php /** * Generated by Protobuf protoc plugin. * * File descriptor : descriptor.proto */ namespace google\protobuf; /** * Protobuf message : google.protobuf.FileDescriptorSet */ class FileDescriptorSet extends \Protobuf\AbstractMessage { /** * @var \Protobuf\UnknownFieldSet */ protected $unknownFieldSet = null; /** * @var \Protobuf\Extension\ExtensionFieldMap */ protected $extensions = null; /** * file repeated message = 1 * * @var \Protobuf\Collection<\google\protobuf\FileDescriptorProto> */ protected $file = null; /** * Check if 'file' has a value * * @return bool */ public function hasFileList() { return $this->file !== null; } /** * Get 'file' value * * @return \Protobuf\Collection<\google\protobuf\FileDescriptorProto> */ public function getFileList() { return $this->file; } /** * Set 'file' value * * @param \Protobuf\Collection<\google\protobuf\FileDescriptorProto> $value */ public function setFileList(\Protobuf\Collection $value = null) { $this->file = $value; } /** * Add a new element to 'file' * * @param \google\protobuf\FileDescriptorProto $value */ public function addFile(\google\protobuf\FileDescriptorProto $value) { if ($this->file === null) { $this->file = new \Protobuf\MessageCollection(); } $this->file->add($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([ 'file' => [] ], $values); foreach ($values['file'] as $item) { $message->addFile($item); } return $message; } /** * {@inheritdoc} */ public static function descriptor() { return \google\protobuf\DescriptorProto::fromArray([ 'name' => 'FileDescriptorSet', 'field' => [ \google\protobuf\FieldDescriptorProto::fromArray([ 'number' => 1, 'name' => 'file', 'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(), 'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(), 'type_name' => '.google.protobuf.FileDescriptorProto' ]), ], ]); } /** * {@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->file !== null) { foreach ($this->file as $val) { $writer->writeVarint($stream, 10); $writer->writeVarint($stream, $val->serializedSize($sizeContext)); $val->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 \google\protobuf\FileDescriptorProto(); if ($this->file === null) { $this->file = new \Protobuf\MessageCollection(); } $this->file->add($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->file !== null) { foreach ($this->file as $val) { $innerSize = $val->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->file = null; } /** * {@inheritdoc} */ public function merge(\Protobuf\Message $message) { if ( ! $message instanceof \google\protobuf\FileDescriptorSet) { throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message))); } $this->file = ($message->file !== null) ? $message->file : $this->file; } }
/var/www/axolotl/data/www/arhangelsk.axolotls.ru/a537b/vendor.tar