diff options
Diffstat (limited to 'third_party/protobuf/3.2.0/php/src/Google')
47 files changed, 0 insertions, 9934 deletions
diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorPool.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorPool.php deleted file mode 100644 index 2c00dfb60b..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorPool.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\Descriptor; -use Google\Protobuf\Internal\FileDescriptor; -use Google\Protobuf\Internal\FileDescriptorSet; -use Google\Protobuf\Internal\MessageBuilderContext; -use Google\Protobuf\Internal\EnumBuilderContext; - -class DescriptorPool -{ - private static $pool; - // Map from message names to sub-maps, which are maps from field numbers to - // field descriptors. - private $class_to_desc = []; - private $class_to_enum_desc = []; - private $proto_to_class = []; - - public static function getGeneratedPool() - { - if (!isset(self::$pool)) { - self::$pool = new DescriptorPool(); - } - return self::$pool; - } - - public function internalAddGeneratedFile($data) - { - $files = new FileDescriptorSet(); - $files->mergeFromString($data); - $file = FileDescriptor::buildFromProto($files->getFile()[0]); - - foreach ($file->getMessageType() as &$desc) { - $this->addDescriptor($desc); - } - unset($desc); - - foreach ($file->getEnumType() as &$desc) { - $this->addEnumDescriptor($desc); - } - unset($desc); - - foreach ($file->getMessageType() as &$desc) { - $this->crossLink($desc); - } - unset($desc); - } - - public function addMessage($name, $klass) - { - return new MessageBuilderContext($name, $klass, $this); - } - - public function addEnum($name, $klass) - { - return new EnumBuilderContext($name, $klass, $this); - } - - public function addDescriptor($descriptor) - { - $this->proto_to_class[$descriptor->getFullName()] = - $descriptor->getClass(); - $this->class_to_desc[$descriptor->getClass()] = $descriptor; - foreach ($descriptor->getNestedType() as $nested_type) { - $this->addDescriptor($nested_type); - } - foreach ($descriptor->getEnumType() as $enum_type) { - $this->addEnumDescriptor($enum_type); - } - } - - public function addEnumDescriptor($descriptor) - { - $this->proto_to_class[$descriptor->getFullName()] = - $descriptor->getClass(); - $this->class_to_enum_desc[$descriptor->getClass()] = $descriptor; - } - - public function getDescriptorByClassName($klass) - { - return $this->class_to_desc[$klass]; - } - - public function getEnumDescriptorByClassName($klass) - { - return $this->class_to_enum_desc[$klass]; - } - - public function getDescriptorByProtoName($proto) - { - $klass = $this->proto_to_class[$proto]; - return $this->class_to_desc[$klass]; - } - - public function getEnumDescriptorByProtoName($proto) - { - $klass = $this->proto_to_class[$proto]; - return $this->class_to_enum_desc[$klass]; - } - - private function crossLink(&$desc) - { - foreach ($desc->getField() as &$field) { - switch ($field->getType()) { - case GPBType::MESSAGE: - $proto = $field->getMessageType(); - $field->setMessageType( - $this->getDescriptorByProtoName($proto)); - break; - case GPBType::ENUM: - $proto = $field->getEnumType(); - $field->setEnumType( - $this->getEnumDescriptorByProtoName($proto)); - break; - default: - break; - } - } - unset($field); - - foreach ($desc->getNestedType() as &$nested_type) { - $this->crossLink($nested_type); - } - unset($nested_type); - } - - public function finish() - { - foreach ($this->class_to_desc as $klass => &$desc) { - $this->crossLink($desc); - } - unset($desc); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto.php deleted file mode 100644 index 948c5876bb..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ /dev/null @@ -1,325 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a message type. - * </pre> - * - * Protobuf type <code>google.protobuf.DescriptorProto</code> - */ -class DescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code> - */ - private $field; - private $has_field = false; - /** - * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code> - */ - private $extension; - private $has_extension = false; - /** - * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code> - */ - private $nested_type; - private $has_nested_type = false; - /** - * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code> - */ - private $enum_type; - private $has_enum_type = false; - /** - * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code> - */ - private $extension_range; - private $has_extension_range = false; - /** - * <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code> - */ - private $oneof_decl; - private $has_oneof_decl = false; - /** - * <code>optional .google.protobuf.MessageOptions options = 7;</code> - */ - private $options = null; - private $has_options = false; - /** - * <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code> - */ - private $reserved_range; - private $has_reserved_range = false; - /** - * <pre> - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. - * </pre> - * - * <code>repeated string reserved_name = 10;</code> - */ - private $reserved_name; - private $has_reserved_name = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code> - */ - public function getField() - { - return $this->field; - } - - /** - * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code> - */ - public function setField(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->field = $arr; - $this->has_field = true; - } - - public function hasField() - { - return $this->has_field; - } - - /** - * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code> - */ - public function getExtension() - { - return $this->extension; - } - - /** - * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code> - */ - public function setExtension(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->extension = $arr; - $this->has_extension = true; - } - - public function hasExtension() - { - return $this->has_extension; - } - - /** - * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code> - */ - public function getNestedType() - { - return $this->nested_type; - } - - /** - * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code> - */ - public function setNestedType(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); - $this->nested_type = $arr; - $this->has_nested_type = true; - } - - public function hasNestedType() - { - return $this->has_nested_type; - } - - /** - * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code> - */ - public function getEnumType() - { - return $this->enum_type; - } - - /** - * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code> - */ - public function setEnumType(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); - $this->enum_type = $arr; - $this->has_enum_type = true; - } - - public function hasEnumType() - { - return $this->has_enum_type; - } - - /** - * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code> - */ - public function getExtensionRange() - { - return $this->extension_range; - } - - /** - * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code> - */ - public function setExtensionRange(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); - $this->extension_range = $arr; - $this->has_extension_range = true; - } - - public function hasExtensionRange() - { - return $this->has_extension_range; - } - - /** - * <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code> - */ - public function getOneofDecl() - { - return $this->oneof_decl; - } - - /** - * <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code> - */ - public function setOneofDecl(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); - $this->oneof_decl = $arr; - $this->has_oneof_decl = true; - } - - public function hasOneofDecl() - { - return $this->has_oneof_decl; - } - - /** - * <code>optional .google.protobuf.MessageOptions options = 7;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.MessageOptions options = 7;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MessageOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - - /** - * <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code> - */ - public function getReservedRange() - { - return $this->reserved_range; - } - - /** - * <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code> - */ - public function setReservedRange(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); - $this->reserved_range = $arr; - $this->has_reserved_range = true; - } - - public function hasReservedRange() - { - return $this->has_reserved_range; - } - - /** - * <pre> - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. - * </pre> - * - * <code>repeated string reserved_name = 10;</code> - */ - public function getReservedName() - { - return $this->reserved_name; - } - - /** - * <pre> - * Reserved field names, which may not be used by fields in the same message. - * A given name may only be reserved once. - * </pre> - * - * <code>repeated string reserved_name = 10;</code> - */ - public function setReservedName(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->reserved_name = $arr; - $this->has_reserved_name = true; - } - - public function hasReservedName() - { - return $this->has_reserved_name; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php deleted file mode 100644 index 738a17389e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.DescriptorProto.ExtensionRange</code> - */ -class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional int32 start = 1;</code> - */ - private $start = 0; - private $has_start = false; - /** - * <code>optional int32 end = 2;</code> - */ - private $end = 0; - private $has_end = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional int32 start = 1;</code> - */ - public function getStart() - { - return $this->start; - } - - /** - * <code>optional int32 start = 1;</code> - */ - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - } - - public function hasStart() - { - return $this->has_start; - } - - /** - * <code>optional int32 end = 2;</code> - */ - public function getEnd() - { - return $this->end; - } - - /** - * <code>optional int32 end = 2;</code> - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php deleted file mode 100644 index be36b8aa38..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Range of reserved tag numbers. Reserved tag numbers may not be used by - * fields or extension ranges in the same message. Reserved ranges may - * not overlap. - * </pre> - * - * Protobuf type <code>google.protobuf.DescriptorProto.ReservedRange</code> - */ -class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Inclusive. - * </pre> - * - * <code>optional int32 start = 1;</code> - */ - private $start = 0; - private $has_start = false; - /** - * <pre> - * Exclusive. - * </pre> - * - * <code>optional int32 end = 2;</code> - */ - private $end = 0; - private $has_end = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Inclusive. - * </pre> - * - * <code>optional int32 start = 1;</code> - */ - public function getStart() - { - return $this->start; - } - - /** - * <pre> - * Inclusive. - * </pre> - * - * <code>optional int32 start = 1;</code> - */ - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - } - - public function hasStart() - { - return $this->has_start; - } - - /** - * <pre> - * Exclusive. - * </pre> - * - * <code>optional int32 end = 2;</code> - */ - public function getEnd() - { - return $this->end; - } - - /** - * <pre> - * Exclusive. - * </pre> - * - * <code>optional int32 end = 2;</code> - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php deleted file mode 100644 index c1dac24dd8..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumBuilderContext.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\EnumDescriptor; -use Google\Protobuf\Internal\EnumValueDescriptor; - -class EnumBuilderContext -{ - - private $descriptor; - private $pool; - - public function __construct($full_name, $klass, $pool) - { - $this->descriptor = new EnumDescriptor(); - $this->descriptor->setFullName($full_name); - $this->descriptor->setClass($klass); - $this->pool = $pool; - } - - public function value($name, $number) - { - $value = new EnumValueDescriptor(); - $this->descriptor->addValue($number, $value); - return $this; - } - - public function finalizeToPool() - { - $this->pool->addEnumDescriptor($this->descriptor); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php deleted file mode 100644 index 73f6edbd9d..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes an enum type. - * </pre> - * - * Protobuf type <code>google.protobuf.EnumDescriptorProto</code> - */ -class EnumDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code> - */ - private $value; - private $has_value = false; - /** - * <code>optional .google.protobuf.EnumOptions options = 3;</code> - */ - private $options = null; - private $has_options = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code> - */ - public function getValue() - { - return $this->value; - } - - /** - * <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code> - */ - public function setValue(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); - $this->value = $arr; - $this->has_value = true; - } - - public function hasValue() - { - return $this->has_value; - } - - /** - * <code>optional .google.protobuf.EnumOptions options = 3;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.EnumOptions options = 3;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumOptions.php deleted file mode 100644 index 4fa0bce79d..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumOptions.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.EnumOptions</code> - */ -class EnumOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Set this option to true to allow mapping different tag names to the same - * value. - * </pre> - * - * <code>optional bool allow_alias = 2;</code> - */ - private $allow_alias = false; - private $has_allow_alias = false; - /** - * <pre> - * Is this enum deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum, or it will be completely ignored; in the very least, this - * is a formalization for deprecating enums. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Set this option to true to allow mapping different tag names to the same - * value. - * </pre> - * - * <code>optional bool allow_alias = 2;</code> - */ - public function getAllowAlias() - { - return $this->allow_alias; - } - - /** - * <pre> - * Set this option to true to allow mapping different tag names to the same - * value. - * </pre> - * - * <code>optional bool allow_alias = 2;</code> - */ - public function setAllowAlias($var) - { - GPBUtil::checkBool($var); - $this->allow_alias = $var; - $this->has_allow_alias = true; - } - - public function hasAllowAlias() - { - return $this->has_allow_alias; - } - - /** - * <pre> - * Is this enum deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum, or it will be completely ignored; in the very least, this - * is a formalization for deprecating enums. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this enum deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum, or it will be completely ignored; in the very least, this - * is a formalization for deprecating enums. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php deleted file mode 100644 index 94dc36ec4e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a value within an enum. - * </pre> - * - * Protobuf type <code>google.protobuf.EnumValueDescriptorProto</code> - */ -class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <code>optional int32 number = 2;</code> - */ - private $number = 0; - private $has_number = false; - /** - * <code>optional .google.protobuf.EnumValueOptions options = 3;</code> - */ - private $options = null; - private $has_options = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <code>optional int32 number = 2;</code> - */ - public function getNumber() - { - return $this->number; - } - - /** - * <code>optional int32 number = 2;</code> - */ - public function setNumber($var) - { - GPBUtil::checkInt32($var); - $this->number = $var; - $this->has_number = true; - } - - public function hasNumber() - { - return $this->has_number; - } - - /** - * <code>optional .google.protobuf.EnumValueOptions options = 3;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.EnumValueOptions options = 3;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php deleted file mode 100644 index 232a6738a6..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.EnumValueOptions</code> - */ -class EnumValueOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Is this enum value deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum value, or it will be completely ignored; in the very least, - * this is a formalization for deprecating enum values. - * </pre> - * - * <code>optional bool deprecated = 1 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Is this enum value deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum value, or it will be completely ignored; in the very least, - * this is a formalization for deprecating enum values. - * </pre> - * - * <code>optional bool deprecated = 1 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this enum value deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the enum value, or it will be completely ignored; in the very least, - * this is a formalization for deprecating enum values. - * </pre> - * - * <code>optional bool deprecated = 1 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php deleted file mode 100644 index 6ae2cd418a..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php +++ /dev/null @@ -1,424 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a field within a message. - * </pre> - * - * Protobuf type <code>google.protobuf.FieldDescriptorProto</code> - */ -class FieldDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <code>optional int32 number = 3;</code> - */ - private $number = 0; - private $has_number = false; - /** - * <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code> - */ - private $label = 0; - private $has_label = false; - /** - * <pre> - * If type_name is set, this need not be set. If both this and type_name - * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - * </pre> - * - * <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code> - */ - private $type = 0; - private $has_type = false; - /** - * <pre> - * For message and enum types, this is the name of the type. If the name - * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - * rules are used to find the type (i.e. first the nested types within this - * message are searched, then within the parent, on up to the root - * namespace). - * </pre> - * - * <code>optional string type_name = 6;</code> - */ - private $type_name = ''; - private $has_type_name = false; - /** - * <pre> - * For extensions, this is the name of the type being extended. It is - * resolved in the same manner as type_name. - * </pre> - * - * <code>optional string extendee = 2;</code> - */ - private $extendee = ''; - private $has_extendee = false; - /** - * <pre> - * For numeric types, contains the original text representation of the value. - * For booleans, "true" or "false". - * For strings, contains the default text contents (not escaped in any way). - * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - * TODO(kenton): Base-64 encode? - * </pre> - * - * <code>optional string default_value = 7;</code> - */ - private $default_value = ''; - private $has_default_value = false; - /** - * <pre> - * If set, gives the index of a oneof in the containing type's oneof_decl - * list. This field is a member of that oneof. - * </pre> - * - * <code>optional int32 oneof_index = 9;</code> - */ - private $oneof_index = 0; - private $has_oneof_index = false; - /** - * <pre> - * JSON name of this field. The value is set by protocol compiler. If the - * user has set a "json_name" option on this field, that option's value - * will be used. Otherwise, it's deduced from the field's name by converting - * it to camelCase. - * </pre> - * - * <code>optional string json_name = 10;</code> - */ - private $json_name = ''; - private $has_json_name = false; - /** - * <code>optional .google.protobuf.FieldOptions options = 8;</code> - */ - private $options = null; - private $has_options = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <code>optional int32 number = 3;</code> - */ - public function getNumber() - { - return $this->number; - } - - /** - * <code>optional int32 number = 3;</code> - */ - public function setNumber($var) - { - GPBUtil::checkInt32($var); - $this->number = $var; - $this->has_number = true; - } - - public function hasNumber() - { - return $this->has_number; - } - - /** - * <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code> - */ - public function getLabel() - { - return $this->label; - } - - /** - * <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code> - */ - public function setLabel($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); - $this->label = $var; - $this->has_label = true; - } - - public function hasLabel() - { - return $this->has_label; - } - - /** - * <pre> - * If type_name is set, this need not be set. If both this and type_name - * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - * </pre> - * - * <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code> - */ - public function getType() - { - return $this->type; - } - - /** - * <pre> - * If type_name is set, this need not be set. If both this and type_name - * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - * </pre> - * - * <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code> - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); - $this->type = $var; - $this->has_type = true; - } - - public function hasType() - { - return $this->has_type; - } - - /** - * <pre> - * For message and enum types, this is the name of the type. If the name - * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - * rules are used to find the type (i.e. first the nested types within this - * message are searched, then within the parent, on up to the root - * namespace). - * </pre> - * - * <code>optional string type_name = 6;</code> - */ - public function getTypeName() - { - return $this->type_name; - } - - /** - * <pre> - * For message and enum types, this is the name of the type. If the name - * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - * rules are used to find the type (i.e. first the nested types within this - * message are searched, then within the parent, on up to the root - * namespace). - * </pre> - * - * <code>optional string type_name = 6;</code> - */ - public function setTypeName($var) - { - GPBUtil::checkString($var, True); - $this->type_name = $var; - $this->has_type_name = true; - } - - public function hasTypeName() - { - return $this->has_type_name; - } - - /** - * <pre> - * For extensions, this is the name of the type being extended. It is - * resolved in the same manner as type_name. - * </pre> - * - * <code>optional string extendee = 2;</code> - */ - public function getExtendee() - { - return $this->extendee; - } - - /** - * <pre> - * For extensions, this is the name of the type being extended. It is - * resolved in the same manner as type_name. - * </pre> - * - * <code>optional string extendee = 2;</code> - */ - public function setExtendee($var) - { - GPBUtil::checkString($var, True); - $this->extendee = $var; - $this->has_extendee = true; - } - - public function hasExtendee() - { - return $this->has_extendee; - } - - /** - * <pre> - * For numeric types, contains the original text representation of the value. - * For booleans, "true" or "false". - * For strings, contains the default text contents (not escaped in any way). - * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - * TODO(kenton): Base-64 encode? - * </pre> - * - * <code>optional string default_value = 7;</code> - */ - public function getDefaultValue() - { - return $this->default_value; - } - - /** - * <pre> - * For numeric types, contains the original text representation of the value. - * For booleans, "true" or "false". - * For strings, contains the default text contents (not escaped in any way). - * For bytes, contains the C escaped value. All bytes >= 128 are escaped. - * TODO(kenton): Base-64 encode? - * </pre> - * - * <code>optional string default_value = 7;</code> - */ - public function setDefaultValue($var) - { - GPBUtil::checkString($var, True); - $this->default_value = $var; - $this->has_default_value = true; - } - - public function hasDefaultValue() - { - return $this->has_default_value; - } - - /** - * <pre> - * If set, gives the index of a oneof in the containing type's oneof_decl - * list. This field is a member of that oneof. - * </pre> - * - * <code>optional int32 oneof_index = 9;</code> - */ - public function getOneofIndex() - { - return $this->oneof_index; - } - - /** - * <pre> - * If set, gives the index of a oneof in the containing type's oneof_decl - * list. This field is a member of that oneof. - * </pre> - * - * <code>optional int32 oneof_index = 9;</code> - */ - public function setOneofIndex($var) - { - GPBUtil::checkInt32($var); - $this->oneof_index = $var; - $this->has_oneof_index = true; - } - - public function hasOneofIndex() - { - return $this->has_oneof_index; - } - - /** - * <pre> - * JSON name of this field. The value is set by protocol compiler. If the - * user has set a "json_name" option on this field, that option's value - * will be used. Otherwise, it's deduced from the field's name by converting - * it to camelCase. - * </pre> - * - * <code>optional string json_name = 10;</code> - */ - public function getJsonName() - { - return $this->json_name; - } - - /** - * <pre> - * JSON name of this field. The value is set by protocol compiler. If the - * user has set a "json_name" option on this field, that option's value - * will be used. Otherwise, it's deduced from the field's name by converting - * it to camelCase. - * </pre> - * - * <code>optional string json_name = 10;</code> - */ - public function setJsonName($var) - { - GPBUtil::checkString($var, True); - $this->json_name = $var; - $this->has_json_name = true; - } - - public function hasJsonName() - { - return $this->has_json_name; - } - - /** - * <code>optional .google.protobuf.FieldOptions options = 8;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.FieldOptions options = 8;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FieldOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php deleted file mode 100644 index a3cd8ef915..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -/** - * Protobuf enum <code>google.protobuf.FieldDescriptorProto.Label</code> - */ -class FieldDescriptorProto_Label -{ - /** - * <pre> - * 0 is reserved for errors - * </pre> - * - * <code>LABEL_OPTIONAL = 1;</code> - */ - const LABEL_OPTIONAL = 1; - /** - * <code>LABEL_REQUIRED = 2;</code> - */ - const LABEL_REQUIRED = 2; - /** - * <code>LABEL_REPEATED = 3;</code> - */ - const LABEL_REPEATED = 3; -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php deleted file mode 100644 index 8335f9b145..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -/** - * Protobuf enum <code>google.protobuf.FieldDescriptorProto.Type</code> - */ -class FieldDescriptorProto_Type -{ - /** - * <pre> - * 0 is reserved for errors. - * Order is weird for historical reasons. - * </pre> - * - * <code>TYPE_DOUBLE = 1;</code> - */ - const TYPE_DOUBLE = 1; - /** - * <code>TYPE_FLOAT = 2;</code> - */ - const TYPE_FLOAT = 2; - /** - * <pre> - * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - * negative values are likely. - * </pre> - * - * <code>TYPE_INT64 = 3;</code> - */ - const TYPE_INT64 = 3; - /** - * <code>TYPE_UINT64 = 4;</code> - */ - const TYPE_UINT64 = 4; - /** - * <pre> - * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - * negative values are likely. - * </pre> - * - * <code>TYPE_INT32 = 5;</code> - */ - const TYPE_INT32 = 5; - /** - * <code>TYPE_FIXED64 = 6;</code> - */ - const TYPE_FIXED64 = 6; - /** - * <code>TYPE_FIXED32 = 7;</code> - */ - const TYPE_FIXED32 = 7; - /** - * <code>TYPE_BOOL = 8;</code> - */ - const TYPE_BOOL = 8; - /** - * <code>TYPE_STRING = 9;</code> - */ - const TYPE_STRING = 9; - /** - * <pre> - * Tag-delimited aggregate. - * Group type is deprecated and not supported in proto3. However, Proto3 - * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. - * </pre> - * - * <code>TYPE_GROUP = 10;</code> - */ - const TYPE_GROUP = 10; - /** - * <pre> - * Length-delimited aggregate. - * </pre> - * - * <code>TYPE_MESSAGE = 11;</code> - */ - const TYPE_MESSAGE = 11; - /** - * <pre> - * New in version 2. - * </pre> - * - * <code>TYPE_BYTES = 12;</code> - */ - const TYPE_BYTES = 12; - /** - * <code>TYPE_UINT32 = 13;</code> - */ - const TYPE_UINT32 = 13; - /** - * <code>TYPE_ENUM = 14;</code> - */ - const TYPE_ENUM = 14; - /** - * <code>TYPE_SFIXED32 = 15;</code> - */ - const TYPE_SFIXED32 = 15; - /** - * <code>TYPE_SFIXED64 = 16;</code> - */ - const TYPE_SFIXED64 = 16; - /** - * <pre> - * Uses ZigZag encoding. - * </pre> - * - * <code>TYPE_SINT32 = 17;</code> - */ - const TYPE_SINT32 = 17; - /** - * <pre> - * Uses ZigZag encoding. - * </pre> - * - * <code>TYPE_SINT64 = 18;</code> - */ - const TYPE_SINT64 = 18; -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions.php deleted file mode 100644 index 8db7ed67aa..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions.php +++ /dev/null @@ -1,429 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.FieldOptions</code> - */ -class FieldOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * The ctype option instructs the C++ code generator to use a different - * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! - * </pre> - * - * <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code> - */ - private $ctype = 0; - private $has_ctype = false; - /** - * <pre> - * The packed option can be enabled for repeated primitive fields to enable - * a more efficient representation on the wire. Rather than repeatedly - * writing the tag and type for each element, the entire array is encoded as - * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. - * </pre> - * - * <code>optional bool packed = 2;</code> - */ - private $packed = false; - private $has_packed = false; - /** - * <pre> - * The jstype option determines the JavaScript type used for values of the - * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). By default these types are - * represented as JavaScript strings. This avoids loss of precision that can - * happen when a large value is converted to a floating point JavaScript - * numbers. Specifying JS_NUMBER for the jstype causes the generated - * JavaScript code to use the JavaScript "number" type instead of strings. - * This option is an enum to permit additional types to be added, - * e.g. goog.math.Integer. - * </pre> - * - * <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code> - */ - private $jstype = 0; - private $has_jstype = false; - /** - * <pre> - * Should this field be parsed lazily? Lazy applies only to message-type - * fields. It means that when the outer message is initially parsed, the - * inner message's contents will not be parsed but instead stored in encoded - * form. The inner message will actually be parsed when it is first accessed. - * This is only a hint. Implementations are free to choose whether to use - * eager or lazy parsing regardless of the value of this option. However, - * setting this option true suggests that the protocol author believes that - * using lazy parsing on this field is worth the additional bookkeeping - * overhead typically needed to implement it. - * This option does not affect the public interface of any generated code; - * all method signatures remain the same. Furthermore, thread-safety of the - * interface is not affected by this option; const methods remain safe to - * call from multiple threads concurrently, while non-const methods continue - * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * </pre> - * - * <code>optional bool lazy = 5 [default = false];</code> - */ - private $lazy = false; - private $has_lazy = false; - /** - * <pre> - * Is this field deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for accessors, or it will be completely ignored; in the very least, this - * is a formalization for deprecating fields. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <pre> - * For Google-internal migration only. Do not use. - * </pre> - * - * <code>optional bool weak = 10 [default = false];</code> - */ - private $weak = false; - private $has_weak = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * The ctype option instructs the C++ code generator to use a different - * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! - * </pre> - * - * <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code> - */ - public function getCtype() - { - return $this->ctype; - } - - /** - * <pre> - * The ctype option instructs the C++ code generator to use a different - * representation of the field than it normally would. See the specific - * options below. This option is not yet implemented in the open source - * release -- sorry, we'll try to include it in a future version! - * </pre> - * - * <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code> - */ - public function setCtype($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_CType::class); - $this->ctype = $var; - $this->has_ctype = true; - } - - public function hasCtype() - { - return $this->has_ctype; - } - - /** - * <pre> - * The packed option can be enabled for repeated primitive fields to enable - * a more efficient representation on the wire. Rather than repeatedly - * writing the tag and type for each element, the entire array is encoded as - * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. - * </pre> - * - * <code>optional bool packed = 2;</code> - */ - public function getPacked() - { - return $this->packed; - } - - /** - * <pre> - * The packed option can be enabled for repeated primitive fields to enable - * a more efficient representation on the wire. Rather than repeatedly - * writing the tag and type for each element, the entire array is encoded as - * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. - * </pre> - * - * <code>optional bool packed = 2;</code> - */ - public function setPacked($var) - { - GPBUtil::checkBool($var); - $this->packed = $var; - $this->has_packed = true; - } - - public function hasPacked() - { - return $this->has_packed; - } - - /** - * <pre> - * The jstype option determines the JavaScript type used for values of the - * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). By default these types are - * represented as JavaScript strings. This avoids loss of precision that can - * happen when a large value is converted to a floating point JavaScript - * numbers. Specifying JS_NUMBER for the jstype causes the generated - * JavaScript code to use the JavaScript "number" type instead of strings. - * This option is an enum to permit additional types to be added, - * e.g. goog.math.Integer. - * </pre> - * - * <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code> - */ - public function getJstype() - { - return $this->jstype; - } - - /** - * <pre> - * The jstype option determines the JavaScript type used for values of the - * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). By default these types are - * represented as JavaScript strings. This avoids loss of precision that can - * happen when a large value is converted to a floating point JavaScript - * numbers. Specifying JS_NUMBER for the jstype causes the generated - * JavaScript code to use the JavaScript "number" type instead of strings. - * This option is an enum to permit additional types to be added, - * e.g. goog.math.Integer. - * </pre> - * - * <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code> - */ - public function setJstype($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FieldOptions_JSType::class); - $this->jstype = $var; - $this->has_jstype = true; - } - - public function hasJstype() - { - return $this->has_jstype; - } - - /** - * <pre> - * Should this field be parsed lazily? Lazy applies only to message-type - * fields. It means that when the outer message is initially parsed, the - * inner message's contents will not be parsed but instead stored in encoded - * form. The inner message will actually be parsed when it is first accessed. - * This is only a hint. Implementations are free to choose whether to use - * eager or lazy parsing regardless of the value of this option. However, - * setting this option true suggests that the protocol author believes that - * using lazy parsing on this field is worth the additional bookkeeping - * overhead typically needed to implement it. - * This option does not affect the public interface of any generated code; - * all method signatures remain the same. Furthermore, thread-safety of the - * interface is not affected by this option; const methods remain safe to - * call from multiple threads concurrently, while non-const methods continue - * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * </pre> - * - * <code>optional bool lazy = 5 [default = false];</code> - */ - public function getLazy() - { - return $this->lazy; - } - - /** - * <pre> - * Should this field be parsed lazily? Lazy applies only to message-type - * fields. It means that when the outer message is initially parsed, the - * inner message's contents will not be parsed but instead stored in encoded - * form. The inner message will actually be parsed when it is first accessed. - * This is only a hint. Implementations are free to choose whether to use - * eager or lazy parsing regardless of the value of this option. However, - * setting this option true suggests that the protocol author believes that - * using lazy parsing on this field is worth the additional bookkeeping - * overhead typically needed to implement it. - * This option does not affect the public interface of any generated code; - * all method signatures remain the same. Furthermore, thread-safety of the - * interface is not affected by this option; const methods remain safe to - * call from multiple threads concurrently, while non-const methods continue - * to require exclusive access. - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * </pre> - * - * <code>optional bool lazy = 5 [default = false];</code> - */ - public function setLazy($var) - { - GPBUtil::checkBool($var); - $this->lazy = $var; - $this->has_lazy = true; - } - - public function hasLazy() - { - return $this->has_lazy; - } - - /** - * <pre> - * Is this field deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for accessors, or it will be completely ignored; in the very least, this - * is a formalization for deprecating fields. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this field deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for accessors, or it will be completely ignored; in the very least, this - * is a formalization for deprecating fields. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <pre> - * For Google-internal migration only. Do not use. - * </pre> - * - * <code>optional bool weak = 10 [default = false];</code> - */ - public function getWeak() - { - return $this->weak; - } - - /** - * <pre> - * For Google-internal migration only. Do not use. - * </pre> - * - * <code>optional bool weak = 10 [default = false];</code> - */ - public function setWeak($var) - { - GPBUtil::checkBool($var); - $this->weak = $var; - $this->has_weak = true; - } - - public function hasWeak() - { - return $this->has_weak; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions_CType.php deleted file mode 100644 index f59f20be11..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions_CType.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -/** - * Protobuf enum <code>google.protobuf.FieldOptions.CType</code> - */ -class FieldOptions_CType -{ - /** - * <pre> - * Default mode. - * </pre> - * - * <code>STRING = 0;</code> - */ - const STRING = 0; - /** - * <code>CORD = 1;</code> - */ - const CORD = 1; - /** - * <code>STRING_PIECE = 2;</code> - */ - const STRING_PIECE = 2; -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php deleted file mode 100644 index 0c6995b7c3..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -/** - * Protobuf enum <code>google.protobuf.FieldOptions.JSType</code> - */ -class FieldOptions_JSType -{ - /** - * <pre> - * Use the default type. - * </pre> - * - * <code>JS_NORMAL = 0;</code> - */ - const JS_NORMAL = 0; - /** - * <pre> - * Use JavaScript strings. - * </pre> - * - * <code>JS_STRING = 1;</code> - */ - const JS_STRING = 1; - /** - * <pre> - * Use JavaScript numbers. - * </pre> - * - * <code>JS_NUMBER = 2;</code> - */ - const JS_NUMBER = 2; -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php deleted file mode 100644 index 0363d9e98c..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ /dev/null @@ -1,477 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a complete .proto file. - * </pre> - * - * Protobuf type <code>google.protobuf.FileDescriptorProto</code> - */ -class FileDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * file name, relative to root of source tree - * </pre> - * - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <pre> - * e.g. "foo", "foo.bar", etc. - * </pre> - * - * <code>optional string package = 2;</code> - */ - private $package = ''; - private $has_package = false; - /** - * <pre> - * Names of files imported by this file. - * </pre> - * - * <code>repeated string dependency = 3;</code> - */ - private $dependency; - private $has_dependency = false; - /** - * <pre> - * Indexes of the public imported files in the dependency list above. - * </pre> - * - * <code>repeated int32 public_dependency = 10;</code> - */ - private $public_dependency; - private $has_public_dependency = false; - /** - * <pre> - * Indexes of the weak imported files in the dependency list. - * For Google-internal migration only. Do not use. - * </pre> - * - * <code>repeated int32 weak_dependency = 11;</code> - */ - private $weak_dependency; - private $has_weak_dependency = false; - /** - * <pre> - * All top-level definitions in this file. - * </pre> - * - * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code> - */ - private $message_type; - private $has_message_type = false; - /** - * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code> - */ - private $enum_type; - private $has_enum_type = false; - /** - * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code> - */ - private $service; - private $has_service = false; - /** - * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code> - */ - private $extension; - private $has_extension = false; - /** - * <code>optional .google.protobuf.FileOptions options = 8;</code> - */ - private $options = null; - private $has_options = false; - /** - * <pre> - * This field contains optional information about the original source code. - * You may safely remove this entire field without harming runtime - * functionality of the descriptors -- the information is needed only by - * development tools. - * </pre> - * - * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code> - */ - private $source_code_info = null; - private $has_source_code_info = false; - /** - * <pre> - * The syntax of the proto file. - * The supported values are "proto2" and "proto3". - * </pre> - * - * <code>optional string syntax = 12;</code> - */ - private $syntax = ''; - private $has_syntax = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * file name, relative to root of source tree - * </pre> - * - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <pre> - * file name, relative to root of source tree - * </pre> - * - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <pre> - * e.g. "foo", "foo.bar", etc. - * </pre> - * - * <code>optional string package = 2;</code> - */ - public function getPackage() - { - return $this->package; - } - - /** - * <pre> - * e.g. "foo", "foo.bar", etc. - * </pre> - * - * <code>optional string package = 2;</code> - */ - public function setPackage($var) - { - GPBUtil::checkString($var, True); - $this->package = $var; - $this->has_package = true; - } - - public function hasPackage() - { - return $this->has_package; - } - - /** - * <pre> - * Names of files imported by this file. - * </pre> - * - * <code>repeated string dependency = 3;</code> - */ - public function getDependency() - { - return $this->dependency; - } - - /** - * <pre> - * Names of files imported by this file. - * </pre> - * - * <code>repeated string dependency = 3;</code> - */ - public function setDependency(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->dependency = $arr; - $this->has_dependency = true; - } - - public function hasDependency() - { - return $this->has_dependency; - } - - /** - * <pre> - * Indexes of the public imported files in the dependency list above. - * </pre> - * - * <code>repeated int32 public_dependency = 10;</code> - */ - public function getPublicDependency() - { - return $this->public_dependency; - } - - /** - * <pre> - * Indexes of the public imported files in the dependency list above. - * </pre> - * - * <code>repeated int32 public_dependency = 10;</code> - */ - public function setPublicDependency(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->public_dependency = $arr; - $this->has_public_dependency = true; - } - - public function hasPublicDependency() - { - return $this->has_public_dependency; - } - - /** - * <pre> - * Indexes of the weak imported files in the dependency list. - * For Google-internal migration only. Do not use. - * </pre> - * - * <code>repeated int32 weak_dependency = 11;</code> - */ - public function getWeakDependency() - { - return $this->weak_dependency; - } - - /** - * <pre> - * Indexes of the weak imported files in the dependency list. - * For Google-internal migration only. Do not use. - * </pre> - * - * <code>repeated int32 weak_dependency = 11;</code> - */ - public function setWeakDependency(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->weak_dependency = $arr; - $this->has_weak_dependency = true; - } - - public function hasWeakDependency() - { - return $this->has_weak_dependency; - } - - /** - * <pre> - * All top-level definitions in this file. - * </pre> - * - * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code> - */ - public function getMessageType() - { - return $this->message_type; - } - - /** - * <pre> - * All top-level definitions in this file. - * </pre> - * - * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code> - */ - public function setMessageType(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); - $this->message_type = $arr; - $this->has_message_type = true; - } - - public function hasMessageType() - { - return $this->has_message_type; - } - - /** - * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code> - */ - public function getEnumType() - { - return $this->enum_type; - } - - /** - * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code> - */ - public function setEnumType(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); - $this->enum_type = $arr; - $this->has_enum_type = true; - } - - public function hasEnumType() - { - return $this->has_enum_type; - } - - /** - * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code> - */ - public function getService() - { - return $this->service; - } - - /** - * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code> - */ - public function setService(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); - $this->service = $arr; - $this->has_service = true; - } - - public function hasService() - { - return $this->has_service; - } - - /** - * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code> - */ - public function getExtension() - { - return $this->extension; - } - - /** - * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code> - */ - public function setExtension(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->extension = $arr; - $this->has_extension = true; - } - - public function hasExtension() - { - return $this->has_extension; - } - - /** - * <code>optional .google.protobuf.FileOptions options = 8;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.FileOptions options = 8;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FileOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - - /** - * <pre> - * This field contains optional information about the original source code. - * You may safely remove this entire field without harming runtime - * functionality of the descriptors -- the information is needed only by - * development tools. - * </pre> - * - * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code> - */ - public function getSourceCodeInfo() - { - return $this->source_code_info; - } - - /** - * <pre> - * This field contains optional information about the original source code. - * You may safely remove this entire field without harming runtime - * functionality of the descriptors -- the information is needed only by - * development tools. - * </pre> - * - * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code> - */ - public function setSourceCodeInfo(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\SourceCodeInfo::class); - $this->source_code_info = $var; - $this->has_source_code_info = true; - } - - public function hasSourceCodeInfo() - { - return $this->has_source_code_info; - } - - /** - * <pre> - * The syntax of the proto file. - * The supported values are "proto2" and "proto3". - * </pre> - * - * <code>optional string syntax = 12;</code> - */ - public function getSyntax() - { - return $this->syntax; - } - - /** - * <pre> - * The syntax of the proto file. - * The supported values are "proto2" and "proto3". - * </pre> - * - * <code>optional string syntax = 12;</code> - */ - public function setSyntax($var) - { - GPBUtil::checkString($var, True); - $this->syntax = $var; - $this->has_syntax = true; - } - - public function hasSyntax() - { - return $this->has_syntax; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php deleted file mode 100644 index 0bcc80511e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * The protocol compiler can output a FileDescriptorSet containing the .proto - * files it parses. - * </pre> - * - * Protobuf type <code>google.protobuf.FileDescriptorSet</code> - */ -class FileDescriptorSet extends \Google\Protobuf\Internal\Message -{ - /** - * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code> - */ - private $file; - private $has_file = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code> - */ - public function getFile() - { - return $this->file; - } - - /** - * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code> - */ - public function setFile(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); - $this->file = $arr; - $this->has_file = true; - } - - public function hasFile() - { - return $this->has_file; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileOptions.php deleted file mode 100644 index 22653a4f7e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileOptions.php +++ /dev/null @@ -1,784 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.FileOptions</code> - */ -class FileOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Sets the Java package where classes generated from this .proto will be - * placed. By default, the proto package is used, but this is often - * inappropriate because proto packages do not normally start with backwards - * domain names. - * </pre> - * - * <code>optional string java_package = 1;</code> - */ - private $java_package = ''; - private $has_java_package = false; - /** - * <pre> - * If set, all the classes from the .proto file are wrapped in a single - * outer class with the given name. This applies to both Proto1 - * (equivalent to the old "--one_java_file" option) and Proto2 (where - * a .proto always translates to a single class, but you may want to - * explicitly choose the class name). - * </pre> - * - * <code>optional string java_outer_classname = 8;</code> - */ - private $java_outer_classname = ''; - private $has_java_outer_classname = false; - /** - * <pre> - * If set true, then the Java code generator will generate a separate .java - * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the outer class - * named by java_outer_classname. However, the outer class will still be - * generated to contain the file's getDescriptor() method as well as any - * top-level extensions defined in the file. - * </pre> - * - * <code>optional bool java_multiple_files = 10 [default = false];</code> - */ - private $java_multiple_files = false; - private $has_java_multiple_files = false; - /** - * <pre> - * This option does nothing. - * </pre> - * - * <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code> - */ - private $java_generate_equals_and_hash = false; - private $has_java_generate_equals_and_hash = false; - /** - * <pre> - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. - * </pre> - * - * <code>optional bool java_string_check_utf8 = 27 [default = false];</code> - */ - private $java_string_check_utf8 = false; - private $has_java_string_check_utf8 = false; - /** - * <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code> - */ - private $optimize_for = 0; - private $has_optimize_for = false; - /** - * <pre> - * Sets the Go package where structs generated from this .proto will be - * placed. If omitted, the Go package will be derived from the following: - * - The basename of the package import path, if provided. - * - Otherwise, the package statement in the .proto file, if present. - * - Otherwise, the basename of the .proto file, without extension. - * </pre> - * - * <code>optional string go_package = 11;</code> - */ - private $go_package = ''; - private $has_go_package = false; - /** - * <pre> - * Should generic services be generated in each language? "Generic" services - * are not specific to any particular RPC system. They are generated by the - * main code generators in each language (without additional plugins). - * Generic services were the only kind of service generation supported by - * early versions of google.protobuf. - * Generic services are now considered deprecated in favor of using plugins - * that generate code specific to your particular RPC system. Therefore, - * these default to false. Old code which depends on generic services should - * explicitly set them to true. - * </pre> - * - * <code>optional bool cc_generic_services = 16 [default = false];</code> - */ - private $cc_generic_services = false; - private $has_cc_generic_services = false; - /** - * <code>optional bool java_generic_services = 17 [default = false];</code> - */ - private $java_generic_services = false; - private $has_java_generic_services = false; - /** - * <code>optional bool py_generic_services = 18 [default = false];</code> - */ - private $py_generic_services = false; - private $has_py_generic_services = false; - /** - * <pre> - * Is this file deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for everything in the file, or it will be completely ignored; in the very - * least, this is a formalization for deprecating files. - * </pre> - * - * <code>optional bool deprecated = 23 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <pre> - * Enables the use of arenas for the proto messages in this file. This applies - * only to generated classes for C++. - * </pre> - * - * <code>optional bool cc_enable_arenas = 31 [default = false];</code> - */ - private $cc_enable_arenas = false; - private $has_cc_enable_arenas = false; - /** - * <pre> - * Sets the objective c class prefix which is prepended to all objective c - * generated classes from this .proto. There is no default. - * </pre> - * - * <code>optional string objc_class_prefix = 36;</code> - */ - private $objc_class_prefix = ''; - private $has_objc_class_prefix = false; - /** - * <pre> - * Namespace for generated classes; defaults to the package. - * </pre> - * - * <code>optional string csharp_namespace = 37;</code> - */ - private $csharp_namespace = ''; - private $has_csharp_namespace = false; - /** - * <pre> - * By default Swift generators will take the proto package and CamelCase it - * replacing '.' with underscore and use that to prefix the types/symbols - * defined. When this options is provided, they will use this value instead - * to prefix the types/symbols defined. - * </pre> - * - * <code>optional string swift_prefix = 39;</code> - */ - private $swift_prefix = ''; - private $has_swift_prefix = false; - /** - * <pre> - * Sets the php class prefix which is prepended to all php generated classes - * from this .proto. Default is empty. - * </pre> - * - * <code>optional string php_class_prefix = 40;</code> - */ - private $php_class_prefix = ''; - private $has_php_class_prefix = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Sets the Java package where classes generated from this .proto will be - * placed. By default, the proto package is used, but this is often - * inappropriate because proto packages do not normally start with backwards - * domain names. - * </pre> - * - * <code>optional string java_package = 1;</code> - */ - public function getJavaPackage() - { - return $this->java_package; - } - - /** - * <pre> - * Sets the Java package where classes generated from this .proto will be - * placed. By default, the proto package is used, but this is often - * inappropriate because proto packages do not normally start with backwards - * domain names. - * </pre> - * - * <code>optional string java_package = 1;</code> - */ - public function setJavaPackage($var) - { - GPBUtil::checkString($var, True); - $this->java_package = $var; - $this->has_java_package = true; - } - - public function hasJavaPackage() - { - return $this->has_java_package; - } - - /** - * <pre> - * If set, all the classes from the .proto file are wrapped in a single - * outer class with the given name. This applies to both Proto1 - * (equivalent to the old "--one_java_file" option) and Proto2 (where - * a .proto always translates to a single class, but you may want to - * explicitly choose the class name). - * </pre> - * - * <code>optional string java_outer_classname = 8;</code> - */ - public function getJavaOuterClassname() - { - return $this->java_outer_classname; - } - - /** - * <pre> - * If set, all the classes from the .proto file are wrapped in a single - * outer class with the given name. This applies to both Proto1 - * (equivalent to the old "--one_java_file" option) and Proto2 (where - * a .proto always translates to a single class, but you may want to - * explicitly choose the class name). - * </pre> - * - * <code>optional string java_outer_classname = 8;</code> - */ - public function setJavaOuterClassname($var) - { - GPBUtil::checkString($var, True); - $this->java_outer_classname = $var; - $this->has_java_outer_classname = true; - } - - public function hasJavaOuterClassname() - { - return $this->has_java_outer_classname; - } - - /** - * <pre> - * If set true, then the Java code generator will generate a separate .java - * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the outer class - * named by java_outer_classname. However, the outer class will still be - * generated to contain the file's getDescriptor() method as well as any - * top-level extensions defined in the file. - * </pre> - * - * <code>optional bool java_multiple_files = 10 [default = false];</code> - */ - public function getJavaMultipleFiles() - { - return $this->java_multiple_files; - } - - /** - * <pre> - * If set true, then the Java code generator will generate a separate .java - * file for each top-level message, enum, and service defined in the .proto - * file. Thus, these types will *not* be nested inside the outer class - * named by java_outer_classname. However, the outer class will still be - * generated to contain the file's getDescriptor() method as well as any - * top-level extensions defined in the file. - * </pre> - * - * <code>optional bool java_multiple_files = 10 [default = false];</code> - */ - public function setJavaMultipleFiles($var) - { - GPBUtil::checkBool($var); - $this->java_multiple_files = $var; - $this->has_java_multiple_files = true; - } - - public function hasJavaMultipleFiles() - { - return $this->has_java_multiple_files; - } - - /** - * <pre> - * This option does nothing. - * </pre> - * - * <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code> - */ - public function getJavaGenerateEqualsAndHash() - { - return $this->java_generate_equals_and_hash; - } - - /** - * <pre> - * This option does nothing. - * </pre> - * - * <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code> - */ - public function setJavaGenerateEqualsAndHash($var) - { - GPBUtil::checkBool($var); - $this->java_generate_equals_and_hash = $var; - $this->has_java_generate_equals_and_hash = true; - } - - public function hasJavaGenerateEqualsAndHash() - { - return $this->has_java_generate_equals_and_hash; - } - - /** - * <pre> - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. - * </pre> - * - * <code>optional bool java_string_check_utf8 = 27 [default = false];</code> - */ - public function getJavaStringCheckUtf8() - { - return $this->java_string_check_utf8; - } - - /** - * <pre> - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. - * </pre> - * - * <code>optional bool java_string_check_utf8 = 27 [default = false];</code> - */ - public function setJavaStringCheckUtf8($var) - { - GPBUtil::checkBool($var); - $this->java_string_check_utf8 = $var; - $this->has_java_string_check_utf8 = true; - } - - public function hasJavaStringCheckUtf8() - { - return $this->has_java_string_check_utf8; - } - - /** - * <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code> - */ - public function getOptimizeFor() - { - return $this->optimize_for; - } - - /** - * <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code> - */ - public function setOptimizeFor($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); - $this->optimize_for = $var; - $this->has_optimize_for = true; - } - - public function hasOptimizeFor() - { - return $this->has_optimize_for; - } - - /** - * <pre> - * Sets the Go package where structs generated from this .proto will be - * placed. If omitted, the Go package will be derived from the following: - * - The basename of the package import path, if provided. - * - Otherwise, the package statement in the .proto file, if present. - * - Otherwise, the basename of the .proto file, without extension. - * </pre> - * - * <code>optional string go_package = 11;</code> - */ - public function getGoPackage() - { - return $this->go_package; - } - - /** - * <pre> - * Sets the Go package where structs generated from this .proto will be - * placed. If omitted, the Go package will be derived from the following: - * - The basename of the package import path, if provided. - * - Otherwise, the package statement in the .proto file, if present. - * - Otherwise, the basename of the .proto file, without extension. - * </pre> - * - * <code>optional string go_package = 11;</code> - */ - public function setGoPackage($var) - { - GPBUtil::checkString($var, True); - $this->go_package = $var; - $this->has_go_package = true; - } - - public function hasGoPackage() - { - return $this->has_go_package; - } - - /** - * <pre> - * Should generic services be generated in each language? "Generic" services - * are not specific to any particular RPC system. They are generated by the - * main code generators in each language (without additional plugins). - * Generic services were the only kind of service generation supported by - * early versions of google.protobuf. - * Generic services are now considered deprecated in favor of using plugins - * that generate code specific to your particular RPC system. Therefore, - * these default to false. Old code which depends on generic services should - * explicitly set them to true. - * </pre> - * - * <code>optional bool cc_generic_services = 16 [default = false];</code> - */ - public function getCcGenericServices() - { - return $this->cc_generic_services; - } - - /** - * <pre> - * Should generic services be generated in each language? "Generic" services - * are not specific to any particular RPC system. They are generated by the - * main code generators in each language (without additional plugins). - * Generic services were the only kind of service generation supported by - * early versions of google.protobuf. - * Generic services are now considered deprecated in favor of using plugins - * that generate code specific to your particular RPC system. Therefore, - * these default to false. Old code which depends on generic services should - * explicitly set them to true. - * </pre> - * - * <code>optional bool cc_generic_services = 16 [default = false];</code> - */ - public function setCcGenericServices($var) - { - GPBUtil::checkBool($var); - $this->cc_generic_services = $var; - $this->has_cc_generic_services = true; - } - - public function hasCcGenericServices() - { - return $this->has_cc_generic_services; - } - - /** - * <code>optional bool java_generic_services = 17 [default = false];</code> - */ - public function getJavaGenericServices() - { - return $this->java_generic_services; - } - - /** - * <code>optional bool java_generic_services = 17 [default = false];</code> - */ - public function setJavaGenericServices($var) - { - GPBUtil::checkBool($var); - $this->java_generic_services = $var; - $this->has_java_generic_services = true; - } - - public function hasJavaGenericServices() - { - return $this->has_java_generic_services; - } - - /** - * <code>optional bool py_generic_services = 18 [default = false];</code> - */ - public function getPyGenericServices() - { - return $this->py_generic_services; - } - - /** - * <code>optional bool py_generic_services = 18 [default = false];</code> - */ - public function setPyGenericServices($var) - { - GPBUtil::checkBool($var); - $this->py_generic_services = $var; - $this->has_py_generic_services = true; - } - - public function hasPyGenericServices() - { - return $this->has_py_generic_services; - } - - /** - * <pre> - * Is this file deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for everything in the file, or it will be completely ignored; in the very - * least, this is a formalization for deprecating files. - * </pre> - * - * <code>optional bool deprecated = 23 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this file deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for everything in the file, or it will be completely ignored; in the very - * least, this is a formalization for deprecating files. - * </pre> - * - * <code>optional bool deprecated = 23 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <pre> - * Enables the use of arenas for the proto messages in this file. This applies - * only to generated classes for C++. - * </pre> - * - * <code>optional bool cc_enable_arenas = 31 [default = false];</code> - */ - public function getCcEnableArenas() - { - return $this->cc_enable_arenas; - } - - /** - * <pre> - * Enables the use of arenas for the proto messages in this file. This applies - * only to generated classes for C++. - * </pre> - * - * <code>optional bool cc_enable_arenas = 31 [default = false];</code> - */ - public function setCcEnableArenas($var) - { - GPBUtil::checkBool($var); - $this->cc_enable_arenas = $var; - $this->has_cc_enable_arenas = true; - } - - public function hasCcEnableArenas() - { - return $this->has_cc_enable_arenas; - } - - /** - * <pre> - * Sets the objective c class prefix which is prepended to all objective c - * generated classes from this .proto. There is no default. - * </pre> - * - * <code>optional string objc_class_prefix = 36;</code> - */ - public function getObjcClassPrefix() - { - return $this->objc_class_prefix; - } - - /** - * <pre> - * Sets the objective c class prefix which is prepended to all objective c - * generated classes from this .proto. There is no default. - * </pre> - * - * <code>optional string objc_class_prefix = 36;</code> - */ - public function setObjcClassPrefix($var) - { - GPBUtil::checkString($var, True); - $this->objc_class_prefix = $var; - $this->has_objc_class_prefix = true; - } - - public function hasObjcClassPrefix() - { - return $this->has_objc_class_prefix; - } - - /** - * <pre> - * Namespace for generated classes; defaults to the package. - * </pre> - * - * <code>optional string csharp_namespace = 37;</code> - */ - public function getCsharpNamespace() - { - return $this->csharp_namespace; - } - - /** - * <pre> - * Namespace for generated classes; defaults to the package. - * </pre> - * - * <code>optional string csharp_namespace = 37;</code> - */ - public function setCsharpNamespace($var) - { - GPBUtil::checkString($var, True); - $this->csharp_namespace = $var; - $this->has_csharp_namespace = true; - } - - public function hasCsharpNamespace() - { - return $this->has_csharp_namespace; - } - - /** - * <pre> - * By default Swift generators will take the proto package and CamelCase it - * replacing '.' with underscore and use that to prefix the types/symbols - * defined. When this options is provided, they will use this value instead - * to prefix the types/symbols defined. - * </pre> - * - * <code>optional string swift_prefix = 39;</code> - */ - public function getSwiftPrefix() - { - return $this->swift_prefix; - } - - /** - * <pre> - * By default Swift generators will take the proto package and CamelCase it - * replacing '.' with underscore and use that to prefix the types/symbols - * defined. When this options is provided, they will use this value instead - * to prefix the types/symbols defined. - * </pre> - * - * <code>optional string swift_prefix = 39;</code> - */ - public function setSwiftPrefix($var) - { - GPBUtil::checkString($var, True); - $this->swift_prefix = $var; - $this->has_swift_prefix = true; - } - - public function hasSwiftPrefix() - { - return $this->has_swift_prefix; - } - - /** - * <pre> - * Sets the php class prefix which is prepended to all php generated classes - * from this .proto. Default is empty. - * </pre> - * - * <code>optional string php_class_prefix = 40;</code> - */ - public function getPhpClassPrefix() - { - return $this->php_class_prefix; - } - - /** - * <pre> - * Sets the php class prefix which is prepended to all php generated classes - * from this .proto. Default is empty. - * </pre> - * - * <code>optional string php_class_prefix = 40;</code> - */ - public function setPhpClassPrefix($var) - { - GPBUtil::checkString($var, True); - $this->php_class_prefix = $var; - $this->has_php_class_prefix = true; - } - - public function hasPhpClassPrefix() - { - return $this->has_php_class_prefix; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php deleted file mode 100644 index b550e7f17e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -/** - * <pre> - * Generated classes can be optimized for speed or code size. - * </pre> - * - * Protobuf enum <code>google.protobuf.FileOptions.OptimizeMode</code> - */ -class FileOptions_OptimizeMode -{ - /** - * <pre> - * Generate complete code for parsing, serialization, - * </pre> - * - * <code>SPEED = 1;</code> - */ - const SPEED = 1; - /** - * <pre> - * etc. - * </pre> - * - * <code>CODE_SIZE = 2;</code> - */ - const CODE_SIZE = 2; - /** - * <pre> - * Generate code using MessageLite and the lite runtime. - * </pre> - * - * <code>LITE_RUNTIME = 3;</code> - */ - const LITE_RUNTIME = 3; -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php deleted file mode 100644 index 402d542f39..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBDecodeException.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -class GPBDecodeException extends \Exception -{ - public function __construct( - $message, - $code = 0, - \Exception $previous = null) - { - parent::__construct( - "Error occurred during parsing: " . $message, - $code, - $previous); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBLabel.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBLabel.php deleted file mode 100644 index 0fb238415b..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBLabel.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -class GPBLabel -{ - const OPTIONAL = 1; - const REQUIRED = 2; - const REPEATED = 3; -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBType.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBType.php deleted file mode 100644 index fa849ceb06..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBType.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -class GPBType -{ - const DOUBLE = 1; - const FLOAT = 2; - const INT64 = 3; - const UINT64 = 4; - const INT32 = 5; - const FIXED64 = 6; - const FIXED32 = 7; - const BOOL = 8; - const STRING = 9; - const GROUP = 10; - const MESSAGE = 11; - const BYTES = 12; - const UINT32 = 13; - const ENUM = 14; - const SFIXED32 = 15; - const SFIXED64 = 16; - const SINT32 = 17; - const SINT64 = 18; -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBUtil.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBUtil.php deleted file mode 100644 index 0e66ae6f67..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBUtil.php +++ /dev/null @@ -1,245 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\MapField; - -class GPBUtil -{ - public function divideInt64ToInt32($value, &$high, &$low, $trim = false) - { - $isNeg = (bccomp($value, 0) < 0); - if ($isNeg) { - $value = bcsub(0, $value); - } - - $high = (int) bcdiv(bcadd($value, 1), 4294967296); - $low = bcmod($value, 4294967296); - if (bccomp($low, 2147483647) > 0) { - $low = (int) bcsub($low, 4294967296); - } else { - $low = (int) $low; - } - - if ($isNeg) { - $high = ~$high; - $low = ~$low; - $low++; - if (!$low) { - $high++; - } - } - - if ($trim) { - $high = 0; - } - } - - - public static function checkString(&$var, $check_utf8) - { - if (is_array($var) || is_object($var)) { - trigger_error("Expect string.", E_USER_ERROR); - return; - } - if (!is_string($var)) { - $var = strval($var); - } - if ($check_utf8 && !preg_match('//u', $var)) { - trigger_error("Expect utf-8 encoding.", E_USER_ERROR); - return; - } - } - - public static function checkEnum(&$var) - { - static::checkInt32($var); - } - - public static function checkInt32(&$var) - { - if (is_numeric($var)) { - $var = intval($var); - } else { - trigger_error("Expect integer.", E_USER_ERROR); - } - } - - public static function checkUint32(&$var) - { - if (is_numeric($var)) { - if (PHP_INT_SIZE === 8) { - $var = intval($var); - $var |= ((-(($var >> 31) & 0x1)) & ~0xFFFFFFFF); - } else { - if (bccomp($var, 0x7FFFFFFF) > 0) { - $var = bcsub($var, "4294967296"); - } - $var = (int) $var; - } - } else { - trigger_error("Expect integer.", E_USER_ERROR); - } - } - - public static function checkInt64(&$var) - { - if (is_numeric($var)) { - if (PHP_INT_SIZE == 8) { - $var = intval($var); - } else { - $var = bcdiv($var, 1, 0); - } - } else { - trigger_error("Expect integer.", E_USER_ERROR); - } - } - - public static function checkUint64(&$var) - { - if (is_numeric($var)) { - if (PHP_INT_SIZE == 8) { - $var = intval($var); - } else { - $var = bcdiv($var, 1, 0); - } - } else { - trigger_error("Expect integer.", E_USER_ERROR); - } - } - - public static function checkFloat(&$var) - { - if (is_float($var) || is_numeric($var)) { - $var = floatval($var); - } else { - trigger_error("Expect float.", E_USER_ERROR); - } - } - - public static function checkDouble(&$var) - { - if (is_float($var) || is_numeric($var)) { - $var = floatval($var); - } else { - trigger_error("Expect float.", E_USER_ERROR); - } - } - - public static function checkBool(&$var) - { - if (is_array($var) || is_object($var)) { - trigger_error("Expect boolean.", E_USER_ERROR); - return; - } - $var = boolval($var); - } - - public static function checkMessage(&$var, $klass) - { - if (!$var instanceof $klass && !is_null($var)) { - trigger_error("Expect message.", E_USER_ERROR); - } - } - - public static function checkRepeatedField(&$var, $type, $klass = null) - { - if (!$var instanceof RepeatedField && !is_array($var)) { - trigger_error("Expect array.", E_USER_ERROR); - } - if (is_array($var)) { - $tmp = new RepeatedField($type, $klass); - foreach ($var as $value) { - $tmp[] = $value; - } - return $tmp; - } else { - if ($var->getType() != $type) { - trigger_error( - "Expect repeated field of different type.", - E_USER_ERROR); - } - if ($var->getType() === GPBType::MESSAGE && - $var->getClass() !== $klass) { - trigger_error( - "Expect repeated field of different message.", - E_USER_ERROR); - } - return $var; - } - } - - public static function checkMapField(&$var, $key_type, $value_type, $klass = null) - { - if (!$var instanceof MapField && !is_array($var)) { - trigger_error("Expect dict.", E_USER_ERROR); - } - if (is_array($var)) { - $tmp = new MapField($key_type, $value_type, $klass); - foreach ($var as $key => $value) { - $tmp[$key] = $value; - } - return $tmp; - } else { - if ($var->getKeyType() != $key_type) { - trigger_error( - "Expect map field of key type.", - E_USER_ERROR); - } - if ($var->getValueType() != $value_type) { - trigger_error( - "Expect map field of value type.", - E_USER_ERROR); - } - if ($var->getValueType() === GPBType::MESSAGE && - $var->getValueClass() !== $klass) { - trigger_error( - "Expect map field of different value message.", - E_USER_ERROR); - } - return $var; - } - } - - public static function Int64($value) - { - return new Int64($value); - } - - public static function Uint64($value) - { - return new Uint64($value); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBWire.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBWire.php deleted file mode 100644 index 67eb1bee65..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GPBWire.php +++ /dev/null @@ -1,617 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -class GPBWire -{ - - const TAG_TYPE_BITS = 3; - - const WIRETYPE_VARINT = 0; - const WIRETYPE_FIXED64 = 1; - const WIRETYPE_LENGTH_DELIMITED = 2; - const WIRETYPE_START_GROUP = 3; - const WIRETYPE_END_GROUP = 4; - const WIRETYPE_FIXED32 = 5; - - const UNKNOWN = 0; - const NORMAL_FORMAT = 1; - const PACKED_FORMAT = 2; - - public static function getTagFieldNumber($tag) - { - return ($tag >> self::TAG_TYPE_BITS) & - (1 << ((PHP_INT_SIZE * 8) - self::TAG_TYPE_BITS)) - 1; - } - - public static function getTagWireType($tag) - { - return $tag & 0x7; - } - - public static function getWireType($type) - { - switch ($type) { - case GPBType::FLOAT: - case GPBType::FIXED32: - case GPBType::SFIXED32: - return self::WIRETYPE_FIXED32; - case GPBType::DOUBLE: - case GPBType::FIXED64: - case GPBType::SFIXED64: - return self::WIRETYPE_FIXED64; - case GPBType::UINT32: - case GPBType::UINT64: - case GPBType::INT32: - case GPBType::INT64: - case GPBType::SINT32: - case GPBType::SINT64: - case GPBType::ENUM: - case GPBType::BOOL: - return self::WIRETYPE_VARINT; - case GPBType::STRING: - case GPBType::BYTES: - case GPBType::MESSAGE: - return self::WIRETYPE_LENGTH_DELIMITED; - case GPBType::GROUP: - user_error("Unsupported type."); - return 0; - default: - user_error("Unsupported type."); - return 0; - } - } - - // ZigZag Transform: Encodes signed integers so that they can be effectively - // used with varint encoding. - // - // varint operates on unsigned integers, encoding smaller numbers into fewer - // bytes. If you try to use it on a signed integer, it will treat this - // number as a very large unsigned integer, which means that even small - // signed numbers like -1 will take the maximum number of bytes (10) to - // encode. zigZagEncode() maps signed integers to unsigned in such a way - // that those with a small absolute value will have smaller encoded values, - // making them appropriate for encoding using varint. - // - // int32 -> uint32 - // ------------------------- - // 0 -> 0 - // -1 -> 1 - // 1 -> 2 - // -2 -> 3 - // ... -> ... - // 2147483647 -> 4294967294 - // -2147483648 -> 4294967295 - // - // >> encode >> - // << decode << - public static function zigZagEncode32($int32) - { - // Fill high 32 bits. - if (PHP_INT_SIZE === 8) { - $int32 |= ((($int32 << 32) >> 31) & (0xFFFFFFFF << 32)); - } - - $uint32 = ($int32 << 1) ^ ($int32 >> 31); - - // Fill high 32 bits. - if (PHP_INT_SIZE === 8) { - $uint32 |= ((($uint32 << 32) >> 31) & (0xFFFFFFFF << 32)); - } - - return $uint32; - } - - public static function zigZagDecode32($uint32) - { - // Fill high 32 bits. - if (PHP_INT_SIZE === 8) { - $uint32 |= ($uint32 & 0xFFFFFFFF); - } - - $int32 = (($uint32 >> 1) & 0x7FFFFFFF) ^ (-($uint32 & 1)); - - return $int32; - } - - public static function zigZagEncode64($int64) - { - if (PHP_INT_SIZE == 4) { - if (bccomp($int64, 0) >= 0) { - return bcmul($int64, 2); - } else { - return bcsub(bcmul(bcsub(0, $int64), 2), 1); - } - } else { - return ($int64 << 1) ^ ($int64 >> 63); - } - } - - public static function zigZagDecode64($uint64) - { - if (PHP_INT_SIZE == 4) { - if (bcmod($uint64, 2) == 0) { - return bcdiv($uint64, 2, 0); - } else { - return bcsub(0, bcdiv(bcadd($uint64, 1), 2, 0)); - } - } else { - return (($uint64 >> 1) & 0x7FFFFFFFFFFFFFFF) ^ (-($uint64 & 1)); - } - } - - public static function readInt32(&$input, &$value) - { - return $input->readVarint32($value); - } - - public static function readInt64(&$input, &$value) - { - return $input->readVarint64($value); - } - - public static function readUint32(&$input, &$value) - { - return self::readInt32($input, $value); - } - - public static function readUint64(&$input, &$value) - { - return self::readInt64($input, $value); - } - - public static function readSint32(&$input, &$value) - { - if (!$input->readVarint32($value)) { - return false; - } - $value = GPBWire::zigZagDecode32($value); - return true; - } - - public static function readSint64(&$input, &$value) - { - if (!$input->readVarint64($value)) { - return false; - } - $value = GPBWire::zigZagDecode64($value); - return true; - } - - public static function readFixed32(&$input, &$value) - { - return $input->readLittleEndian32($value); - } - - public static function readFixed64(&$input, &$value) - { - return $input->readLittleEndian64($value); - } - - public static function readSfixed32(&$input, &$value) - { - if (!self::readFixed32($input, $value)) { - return false; - } - if (PHP_INT_SIZE === 8) { - $value |= (-($value >> 31) << 32); - } - return true; - } - - public static function readSfixed64(&$input, &$value) - { - return $input->readLittleEndian64($value); - } - - public static function readFloat(&$input, &$value) - { - $data = null; - if (!$input->readRaw(4, $data)) { - return false; - } - $value = unpack('f', $data)[1]; - return true; - } - - public static function readDouble(&$input, &$value) - { - $data = null; - if (!$input->readRaw(8, $data)) { - return false; - } - $value = unpack('d', $data)[1]; - return true; - } - - public static function readBool(&$input, &$value) - { - if (!$input->readVarint64($value)) { - return false; - } - if ($value == 0) { - $value = false; - } else { - $value = true; - } - return true; - } - - public static function readString(&$input, &$value) - { - $length = 0; - return $input->readVarintSizeAsInt($length) && $input->readRaw($length, $value); - } - - public static function readMessage(&$input, &$message) - { - $length = 0; - if (!$input->readVarintSizeAsInt($length)) { - return false; - } - $old_limit = 0; - $recursion_limit = 0; - $input->incrementRecursionDepthAndPushLimit( - $length, - $old_limit, - $recursion_limit); - if ($recursion_limit < 0 || !$message->parseFromStream($input)) { - return false; - } - return $input->decrementRecursionDepthAndPopLimit($old_limit); - } - - public static function writeTag(&$output, $tag) - { - return $output->writeTag($tag); - } - - public static function writeInt32(&$output, $value) - { - return $output->writeVarint32($value); - } - - public static function writeInt64(&$output, $value) - { - return $output->writeVarint64($value); - } - - public static function writeUint32(&$output, $value) - { - return $output->writeVarint32($value); - } - - public static function writeUint64(&$output, $value) - { - return $output->writeVarint64($value); - } - - public static function writeSint32(&$output, $value) - { - $value = GPBWire::zigZagEncode32($value); - return $output->writeVarint64($value); - } - - public static function writeSint64(&$output, $value) - { - $value = GPBWire::zigZagEncode64($value); - return $output->writeVarint64($value); - } - - public static function writeFixed32(&$output, $value) - { - return $output->writeLittleEndian32($value); - } - - public static function writeFixed64(&$output, $value) - { - return $output->writeLittleEndian64($value); - } - - public static function writeSfixed32(&$output, $value) - { - return $output->writeLittleEndian32($value); - } - - public static function writeSfixed64(&$output, $value) - { - return $output->writeLittleEndian64($value); - } - - public static function writeBool(&$output, $value) - { - if ($value) { - return $output->writeVarint32(1); - } else { - return $output->writeVarint32(0); - } - } - - public static function writeFloat(&$output, $value) - { - $data = pack("f", $value); - return $output->writeRaw($data, 4); - } - - public static function writeDouble(&$output, $value) - { - $data = pack("d", $value); - return $output->writeRaw($data, 8); - } - - public static function writeString(&$output, $value) - { - return self::writeBytes($output, $value); - } - - public static function writeBytes(&$output, $value) - { - $size = strlen($value); - if (!$output->writeVarint32($size)) { - return false; - } - return $output->writeRaw($value, $size); - } - - public static function writeMessage(&$output, $value) - { - $size = $value->byteSize(); - if (!$output->writeVarint32($size)) { - return false; - } - return $value->serializeToStream($output); - } - - public static function makeTag($number, $type) - { - return ($number << 3) | self::getWireType($type); - } - - public static function tagSize($field) - { - $tag = self::makeTag($field->getNumber(), $field->getType()); - return self::varint32Size($tag); - } - - public static function varint32Size($value, $sign_extended = false) - { - if ($value < 0) { - if ($sign_extended) { - return 10; - } else { - return 5; - } - } - if ($value < (1 << 7)) { - return 1; - } - if ($value < (1 << 14)) { - return 2; - } - if ($value < (1 << 21)) { - return 3; - } - if ($value < (1 << 28)) { - return 4; - } - return 5; - } - - public static function sint32Size($value) - { - $value = self::zigZagEncode32($value); - return self::varint32Size($value); - } - - public static function sint64Size($value) - { - $value = self::zigZagEncode64($value); - return self::varint64Size($value); - } - - public static function varint64Size($value) - { - if (PHP_INT_SIZE == 4) { - if (bccomp($value, 0) < 0) { - return 10; - } - if (bccomp($value, 1 << 7) < 0) { - return 1; - } - if (bccomp($value, 1 << 14) < 0) { - return 2; - } - if (bccomp($value, 1 << 21) < 0) { - return 3; - } - if (bccomp($value, 1 << 28) < 0) { - return 4; - } - if (bccomp($value, '34359738368') < 0) { - return 5; - } - if (bccomp($value, '4398046511104') < 0) { - return 6; - } - if (bccomp($value, '562949953421312') < 0) { - return 7; - } - if (bccomp($value, '72057594037927936') < 0) { - return 8; - } - return 9; - } else { - if ($value < 0) { - return 10; - } - if ($value < (1 << 7)) { - return 1; - } - if ($value < (1 << 14)) { - return 2; - } - if ($value < (1 << 21)) { - return 3; - } - if ($value < (1 << 28)) { - return 4; - } - if ($value < (1 << 35)) { - return 5; - } - if ($value < (1 << 42)) { - return 6; - } - if ($value < (1 << 49)) { - return 7; - } - if ($value < (1 << 56)) { - return 8; - } - return 9; - } - } - - public static function serializeFieldToStream( - $value, - $field, - $need_tag, - &$output) - { - if ($need_tag) { - if (!GPBWire::writeTag( - $output, - self::makeTag( - $field->getNumber(), - $field->getType()))) { - return false; - } - } - switch ($field->getType()) { - case GPBType::DOUBLE: - if (!GPBWire::writeDouble($output, $value)) { - return false; - } - break; - case GPBType::FLOAT: - if (!GPBWire::writeFloat($output, $value)) { - return false; - } - break; - case GPBType::INT64: - if (!GPBWire::writeInt64($output, $value)) { - return false; - } - break; - case GPBType::UINT64: - if (!GPBWire::writeUint64($output, $value)) { - return false; - } - break; - case GPBType::INT32: - if (!GPBWire::writeInt32($output, $value)) { - return false; - } - break; - case GPBType::FIXED32: - if (!GPBWire::writeFixed32($output, $value)) { - return false; - } - break; - case GPBType::FIXED64: - if (!GPBWire::writeFixed64($output, $value)) { - return false; - } - break; - case GPBType::BOOL: - if (!GPBWire::writeBool($output, $value)) { - return false; - } - break; - case GPBType::STRING: - if (!GPBWire::writeString($output, $value)) { - return false; - } - break; - // case GPBType::GROUP: - // echo "GROUP\xA"; - // trigger_error("Not implemented.", E_ERROR); - // break; - case GPBType::MESSAGE: - if (!GPBWire::writeMessage($output, $value)) { - return false; - } - break; - case GPBType::BYTES: - if (!GPBWire::writeBytes($output, $value)) { - return false; - } - break; - case GPBType::UINT32: - if (!GPBWire::writeUint32($output, $value)) { - return false; - } - break; - case GPBType::ENUM: - if (!GPBWire::writeInt32($output, $value)) { - return false; - } - break; - case GPBType::SFIXED32: - if (!GPBWire::writeSfixed32($output, $value)) { - return false; - } - break; - case GPBType::SFIXED64: - if (!GPBWire::writeSfixed64($output, $value)) { - return false; - } - break; - case GPBType::SINT32: - if (!GPBWire::writeSint32($output, $value)) { - return false; - } - break; - case GPBType::SINT64: - if (!GPBWire::writeSint64($output, $value)) { - return false; - } - break; - default: - user_error("Unsupported type."); - return false; - } - - return true; - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php deleted file mode 100644 index 450854f172..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes the relationship between generated code and its original source - * file. A GeneratedCodeInfo message is associated with only one generated - * source file, but may contain references to different source .proto files. - * </pre> - * - * Protobuf type <code>google.protobuf.GeneratedCodeInfo</code> - */ -class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * An Annotation connects some span of text in generated code to an element - * of its generating .proto file. - * </pre> - * - * <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code> - */ - private $annotation; - private $has_annotation = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * An Annotation connects some span of text in generated code to an element - * of its generating .proto file. - * </pre> - * - * <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code> - */ - public function getAnnotation() - { - return $this->annotation; - } - - /** - * <pre> - * An Annotation connects some span of text in generated code to an element - * of its generating .proto file. - * </pre> - * - * <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code> - */ - public function setAnnotation(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); - $this->annotation = $arr; - $this->has_annotation = true; - } - - public function hasAnnotation() - { - return $this->has_annotation; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php deleted file mode 100644 index ed22cc387d..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ /dev/null @@ -1,198 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.GeneratedCodeInfo.Annotation</code> - */ -class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * </pre> - * - * <code>repeated int32 path = 1 [packed = true];</code> - */ - private $path; - private $has_path = false; - /** - * <pre> - * Identifies the filesystem path to the original source .proto. - * </pre> - * - * <code>optional string source_file = 2;</code> - */ - private $source_file = ''; - private $has_source_file = false; - /** - * <pre> - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * </pre> - * - * <code>optional int32 begin = 3;</code> - */ - private $begin = 0; - private $has_begin = false; - /** - * <pre> - * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past - * the last relevant byte (so the length of the text = end - begin). - * </pre> - * - * <code>optional int32 end = 4;</code> - */ - private $end = 0; - private $has_end = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * </pre> - * - * <code>repeated int32 path = 1 [packed = true];</code> - */ - public function getPath() - { - return $this->path; - } - - /** - * <pre> - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * </pre> - * - * <code>repeated int32 path = 1 [packed = true];</code> - */ - public function setPath(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->path = $arr; - $this->has_path = true; - } - - public function hasPath() - { - return $this->has_path; - } - - /** - * <pre> - * Identifies the filesystem path to the original source .proto. - * </pre> - * - * <code>optional string source_file = 2;</code> - */ - public function getSourceFile() - { - return $this->source_file; - } - - /** - * <pre> - * Identifies the filesystem path to the original source .proto. - * </pre> - * - * <code>optional string source_file = 2;</code> - */ - public function setSourceFile($var) - { - GPBUtil::checkString($var, True); - $this->source_file = $var; - $this->has_source_file = true; - } - - public function hasSourceFile() - { - return $this->has_source_file; - } - - /** - * <pre> - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * </pre> - * - * <code>optional int32 begin = 3;</code> - */ - public function getBegin() - { - return $this->begin; - } - - /** - * <pre> - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * </pre> - * - * <code>optional int32 begin = 3;</code> - */ - public function setBegin($var) - { - GPBUtil::checkInt32($var); - $this->begin = $var; - $this->has_begin = true; - } - - public function hasBegin() - { - return $this->has_begin; - } - - /** - * <pre> - * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past - * the last relevant byte (so the length of the text = end - begin). - * </pre> - * - * <code>optional int32 end = 4;</code> - */ - public function getEnd() - { - return $this->end; - } - - /** - * <pre> - * Identifies the ending offset in bytes in the generated code that - * relates to the identified offset. The end offset should be one past - * the last relevant byte (so the length of the text = end - begin). - * </pre> - * - * <code>optional int32 end = 4;</code> - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/InputStream.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/InputStream.php deleted file mode 100644 index 8012a225e1..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/InputStream.php +++ /dev/null @@ -1,391 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\Uint64; - -function combineInt32ToInt64($high, $low) -{ - $isNeg = $high < 0; - if ($isNeg) { - $high = ~$high; - $low = ~$low; - $low++; - if (!$low) { - $high++; - } - } - $result = bcadd(bcmul($high, 4294967296), $low); - if ($low < 0) { - $result = bcadd($result, 4294967296); - } - if ($isNeg) { - $result = bcsub(0, $result); - } - return $result; -} - -class InputStream -{ - - private $buffer; - private $buffer_size_after_limit; - private $buffer_end; - private $current; - private $current_limit; - private $legitimate_message_end; - private $recursion_budget; - private $recursion_limit; - private $total_bytes_limit; - private $total_bytes_read; - - const MAX_VARINT_BYTES = 10; - const DEFAULT_RECURSION_LIMIT = 100; - const DEFAULT_TOTAL_BYTES_LIMIT = 33554432; // 32 << 20, 32MB - - public function __construct($buffer) - { - $start = 0; - $end = strlen($buffer); - $this->buffer = $buffer; - $this->buffer_size_after_limit = 0; - $this->buffer_end = $end; - $this->current = $start; - $this->current_limit = $end; - $this->legitimate_message_end = false; - $this->recursion_budget = self::DEFAULT_RECURSION_LIMIT; - $this->recursion_limit = self::DEFAULT_RECURSION_LIMIT; - $this->total_bytes_limit = self::DEFAULT_TOTAL_BYTES_LIMIT; - $this->total_bytes_read = $end - $start; - } - - private function advance($amount) - { - $this->current += $amount; - } - - private function bufferSize() - { - return $this->buffer_end - $this->current; - } - - private function current() - { - return $this->total_bytes_read - - ($this->buffer_end - $this->current + - $this->buffer_size_after_limit); - } - - private function recomputeBufferLimits() - { - $this->buffer_end += $this->buffer_size_after_limit; - $closest_limit = min($this->current_limit, $this->total_bytes_limit); - if ($closest_limit < $this->total_bytes_read) { - // The limit position is in the current buffer. We must adjust the - // buffer size accordingly. - $this->buffer_size_after_limit = $this->total_bytes_read - - $closest_limit; - $this->buffer_end -= $this->buffer_size_after_limit; - } else { - $this->buffer_size_after_limit = 0; - } - } - - private function consumedEntireMessage() - { - return $this->legitimate_message_end; - } - - /** - * Read uint32 into $var. Advance buffer with consumed bytes. If the - * contained varint is larger than 32 bits, discard the high order bits. - * @param $var. - */ - public function readVarint32(&$var) - { - if (!$this->readVarint64($var)) { - return false; - } - - if (PHP_INT_SIZE == 4) { - $var = bcmod($var, 4294967296); - } else { - $var &= 0xFFFFFFFF; - } - - // Convert large uint32 to int32. - if ($var > 0x7FFFFFFF) { - if (PHP_INT_SIZE === 8) { - $var = $var | (0xFFFFFFFF << 32); - } else { - $var = bcsub($var, 4294967296); - } - } - - $var = intval($var); - return true; - } - - /** - * Read Uint64 into $var. Advance buffer with consumed bytes. - * @param $var. - */ - public function readVarint64(&$var) - { - $count = 0; - - if (PHP_INT_SIZE == 4) { - $high = 0; - $low = 0; - $b = 0; - - do { - if ($this->current === $this->buffer_end) { - return false; - } - if ($count === self::MAX_VARINT_BYTES) { - return false; - } - $b = ord($this->buffer[$this->current]); - $bits = 7 * $count; - if ($bits >= 32) { - $high |= (($b & 0x7F) << ($bits - 32)); - } else if ($bits > 25){ - // $bits is 28 in this case. - $low |= (($b & 0x7F) << 28); - $high = ($b & 0x7F) >> 4; - } else { - $low |= (($b & 0x7F) << $bits); - } - - $this->advance(1); - $count += 1; - } while ($b & 0x80); - - $var = combineInt32ToInt64($high, $low); - } else { - $result = 0; - $shift = 0; - - do { - if ($this->current === $this->buffer_end) { - return false; - } - if ($count === self::MAX_VARINT_BYTES) { - return false; - } - - $byte = ord($this->buffer[$this->current]); - $result |= ($byte & 0x7f) << $shift; - $shift += 7; - $this->advance(1); - $count += 1; - } while ($byte > 0x7f); - - $var = $result; - } - - return true; - } - - /** - * Read int into $var. If the result is larger than the largest integer, $var - * will be -1. Advance buffer with consumed bytes. - * @param $var. - */ - public function readVarintSizeAsInt(&$var) - { - if (!$this->readVarint64($var)) { - return false; - } - $var = (int)$var; - return true; - } - - /** - * Read 32-bit unsiged integer to $var. If the buffer has less than 4 bytes, - * return false. Advance buffer with consumed bytes. - * @param $var. - */ - public function readLittleEndian32(&$var) - { - $data = null; - if (!$this->readRaw(4, $data)) { - return false; - } - $var = unpack('V', $data); - $var = $var[1]; - return true; - } - - /** - * Read 64-bit unsiged integer to $var. If the buffer has less than 8 bytes, - * return false. Advance buffer with consumed bytes. - * @param $var. - */ - public function readLittleEndian64(&$var) - { - $data = null; - if (!$this->readRaw(4, $data)) { - return false; - } - $low = unpack('V', $data)[1]; - if (!$this->readRaw(4, $data)) { - return false; - } - $high = unpack('V', $data)[1]; - if (PHP_INT_SIZE == 4) { - $var = combineInt32ToInt64($high, $low); - } else { - $var = ($high << 32) | $low; - } - return true; - } - - /** - * Read tag into $var. Advance buffer with consumed bytes. - * @param $var. - */ - public function readTag() - { - if ($this->current === $this->buffer_end) { - // Make sure that it failed due to EOF, not because we hit - // total_bytes_limit, which, unlike normal limits, is not a valid - // place to end a message. - $current_position = $this->total_bytes_read - - $this->buffer_size_after_limit; - if ($current_position >= $this->total_bytes_limit) { - // Hit total_bytes_limit_. But if we also hit the normal limit, - // we're still OK. - $this->legitimate_message_end = - ($this->current_limit === $this->total_bytes_limit); - } else { - $this->legitimate_message_end = true; - } - return 0; - } - - $result = 0; - // The larget tag is 2^29 - 1, which can be represented by int32. - $success = $this->readVarint32($result); - if ($success) { - return $result; - } else { - return 0; - } - } - - public function readRaw($size, &$buffer) - { - $current_buffer_size = 0; - if ($this->bufferSize() < $size) { - return false; - } - - $buffer = substr($this->buffer, $this->current, $size); - $this->advance($size); - - return true; - } - - /* Places a limit on the number of bytes that the stream may read, starting - * from the current position. Once the stream hits this limit, it will act - * like the end of the input has been reached until popLimit() is called. - * - * As the names imply, the stream conceptually has a stack of limits. The - * shortest limit on the stack is always enforced, even if it is not the top - * limit. - * - * The value returned by pushLimit() is opaque to the caller, and must be - * passed unchanged to the corresponding call to popLimit(). - * - * @param integer $byte_limit - * @throws Exception Fail to push limit. - */ - public function pushLimit($byte_limit) - { - // Current position relative to the beginning of the stream. - $current_position = $this->current(); - $old_limit = $this->current_limit; - - // security: byte_limit is possibly evil, so check for negative values - // and overflow. - if ($byte_limit >= 0 && - $byte_limit <= PHP_INT_MAX - $current_position && - $byte_limit <= $this->current_limit - $current_position) { - $this->current_limit = $current_position + $byte_limit; - $this->recomputeBufferLimits(); - } else { - throw new GPBDecodeException("Fail to push limit."); - } - - return $old_limit; - } - - /* The limit passed in is actually the *old* limit, which we returned from - * PushLimit(). - * - * @param integer $byte_limit - */ - public function popLimit($byte_limit) - { - $this->current_limit = $byte_limit; - $this->recomputeBufferLimits(); - // We may no longer be at a legitimate message end. ReadTag() needs to - // be called again to find out. - $this->legitimate_message_end = false; - } - - public function incrementRecursionDepthAndPushLimit( - $byte_limit, &$old_limit, &$recursion_budget) - { - $old_limit = $this->pushLimit($byte_limit); - $recursion_limit = --$this->recursion_limit; - } - - public function decrementRecursionDepthAndPopLimit($byte_limit) - { - $result = $this->consumedEntireMessage(); - $this->popLimit($byte_limit); - ++$this->recursion_budget; - return $result; - } - - public function bytesUntilLimit() - { - if ($this->current_limit === PHP_INT_MAX) { - return -1; - } - return $this->current_limit - $this->current; - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MapEntry.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MapEntry.php deleted file mode 100644 index 926645e1db..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MapEntry.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\Message; - -class MapEntry extends Message -{ - public $key; - public $value; - - public function setKey(&$key) { - $this->key = $key; - } - - public function getKey() { - return $this->key; - } - - public function setValue(&$value) { - $this->value = $value; - } - - public function getValue() { - return $this->value; - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MapField.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MapField.php deleted file mode 100644 index 55cc12ce85..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MapField.php +++ /dev/null @@ -1,347 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/** - * MapField and MapFieldIter are used by generated protocol message classes to - * manipulate map fields. - */ - -namespace Google\Protobuf\Internal; - -/** - * MapFieldIter is used to iterate MapField. It is also need for the foreach - * syntax. - */ -class MapFieldIter implements \Iterator -{ - - /** - * @ignore - */ - private $container; - - /** - * Create iterator instance for MapField. - * - * @param MapField The MapField instance for which this iterator is - * created. - * @ignore - */ - public function __construct($container) - { - $this->container = $container; - } - - /** - * Reset the status of the iterator - * - * @return void - */ - public function rewind() - { - return reset($this->container); - } - - /** - * Return the element at the current position. - * - * @return object The element at the current position. - */ - public function current() - { - return current($this->container); - } - - /** - * Return the current key. - * - * @return object The current key. - */ - public function key() - { - return key($this->container); - } - - /** - * Move to the next position. - * - * @return void - */ - public function next() - { - return next($this->container); - } - - /** - * Check whether there are more elements to iterate. - * - * @return bool True if there are more elements to iterate. - */ - public function valid() - { - return key($this->container) !== null; - } -} - -/** - * @ignore - */ -function checkKey($key_type, &$key) -{ - switch ($key_type) { - case GPBType::INT32: - GPBUtil::checkInt32($key); - break; - case GPBType::UINT32: - GPBUtil::checkUint32($key); - break; - case GPBType::INT64: - GPBUtil::checkInt64($key); - break; - case GPBType::UINT64: - GPBUtil::checkUint64($key); - break; - case GPBType::FIXED64: - GPBUtil::checkUint64($key); - break; - case GPBType::FIXED32: - GPBUtil::checkUint32($key); - break; - case GPBType::SFIXED64: - GPBUtil::checkInt64($key); - break; - case GPBType::SFIXED32: - GPBUtil::checkInt32($key); - break; - case GPBType::SINT64: - GPBUtil::checkInt64($key); - break; - case GPBType::SINT32: - GPBUtil::checkInt32($key); - break; - case GPBType::BOOL: - GPBUtil::checkBool($key); - break; - case GPBType::STRING: - GPBUtil::checkString($key, true); - break; - default: - trigger_error( - "Given type cannot be map key.", - E_USER_ERROR); - break; - } -} - -/** - * MapField is used by generated protocol message classes to manipulate map - * fields. It can be used like native PHP array. - */ -class MapField implements \ArrayAccess, \IteratorAggregate, \Countable -{ - /** - * @ignore - */ - private $container; - /** - * @ignore - */ - private $key_type; - /** - * @ignore - */ - private $value_type; - /** - * @ignore - */ - private $value_klass; - - /** - * Constructs an instance of MapField. - * - * @param long $key_type Type of the stored key element. - * @param long $value_type Type of the stored value element. - * @param string $klass Message/Enum class name of value instance - * (message/enum fields only). - * @ignore - */ - public function __construct($key_type, $value_type, $klass = null) - { - $this->container = []; - $this->key_type = $key_type; - $this->value_type = $value_type; - $this->klass = $klass; - } - - /** - * @ignore - */ - public function getKeyType() - { - return $this->key_type; - } - - /** - * @ignore - */ - public function getValueType() - { - return $this->value_type; - } - - /** - * @ignore - */ - public function getValueClass() - { - return $this->klass; - } - - /** - * Return the element at the given key. - * - * This will also be called for: $ele = $arr[$key] - * - * @param object $key The key of the element to be fetched. - * @return object The stored element at given key. - * @throws ErrorException Invalid type for index. - * @throws ErrorException Non-existing index. - */ - public function offsetGet($key) - { - return $this->container[$key]; - } - - /** - * Assign the element at the given key. - * - * This will also be called for: $arr[$key] = $value - * - * @param object $key The key of the element to be fetched. - * @param object $value The element to be assigned. - * @return void - * @throws ErrorException Invalid type for key. - * @throws ErrorException Invalid type for value. - * @throws ErrorException Non-existing key. - */ - public function offsetSet($key, $value) - { - checkKey($this->key_type, $key); - - switch ($this->value_type) { - case GPBType::INT32: - GPBUtil::checkInt32($value); - break; - case GPBType::UINT32: - GPBUtil::checkUint32($value); - break; - case GPBType::INT64: - GPBUtil::checkInt64($value); - break; - case GPBType::UINT64: - GPBUtil::checkUint64($value); - break; - case GPBType::FLOAT: - GPBUtil::checkFloat($value); - break; - case GPBType::DOUBLE: - GPBUtil::checkDouble($value); - break; - case GPBType::BOOL: - GPBUtil::checkBool($value); - break; - case GPBType::STRING: - GPBUtil::checkString($value, true); - break; - case GPBType::MESSAGE: - if (is_null($value)) { - trigger_error("Map element cannot be null.", E_USER_ERROR); - } - GPBUtil::checkMessage($value, $this->klass); - break; - default: - break; - } - - $this->container[$key] = $value; - } - - /** - * Remove the element at the given key. - * - * This will also be called for: unset($arr) - * - * @param object $key The key of the element to be removed. - * @return void - * @throws ErrorException Invalid type for key. - */ - public function offsetUnset($key) - { - checkKey($this->key_type, $key); - unset($this->container[$key]); - } - - /** - * Check the existence of the element at the given key. - * - * This will also be called for: isset($arr) - * - * @param object $key The key of the element to be removed. - * @return bool True if the element at the given key exists. - * @throws ErrorException Invalid type for key. - */ - public function offsetExists($key) - { - checkKey($this->key_type, $key); - return isset($this->container[$key]); - } - - /** - * @ignore - */ - public function getIterator() - { - return new MapFieldIter($this->container); - } - - /** - * Return the number of stored elements. - * - * This will also be called for: count($arr) - * - * @return integer The number of stored elements. - */ - public function count() - { - return count($this->container); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/Message.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/Message.php deleted file mode 100644 index cd15e0f042..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/Message.php +++ /dev/null @@ -1,892 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/** - * Defines Message, the parent class extended by all protocol message classes. - */ - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\InputStream; -use Google\Protobuf\Internal\OutputStream; -use Google\Protobuf\Internal\DescriptorPool; -use Google\Protobuf\Internal\GPBLabel; -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\MapEntry; -use Google\Protobuf\Internal\RepeatedField; - -/** - * Parent class of all proto messages. Users should not instantiate this class - * or extend this class or its child classes by their own. See the comment of - * specific functions for more details. - */ -class Message -{ - - /** - * @ignore - */ - private $desc; - - /** - * @ignore - */ - public function __construct($desc = NULL) - { - // MapEntry message is shared by all types of map fields, whose - // descriptors are different from each other. Thus, we cannot find a - // specific descriptor from the descriptor pool. - if (get_class($this) === 'Google\Protobuf\Internal\MapEntry') { - $this->desc = $desc; - return; - } - $pool = DescriptorPool::getGeneratedPool(); - $this->desc = $pool->getDescriptorByClassName(get_class($this)); - foreach ($this->desc->getField() as $field) { - $setter = $field->getSetter(); - if ($field->isMap()) { - $message_type = $field->getMessageType(); - $key_field = $message_type->getFieldByNumber(1); - $value_field = $message_type->getFieldByNumber(2); - switch ($value_field->getType()) { - case GPBType::MESSAGE: - case GPBType::GROUP: - $map_field = new MapField( - $key_field->getType(), - $value_field->getType(), - $value_field->getMessageType()->getClass()); - $this->$setter($map_field); - break; - case GPBType::ENUM: - $map_field = new MapField( - $key_field->getType(), - $value_field->getType(), - $value_field->getEnumType()->getClass()); - $this->$setter($map_field); - break; - default: - $map_field = new MapField( - $key_field->getType(), - $value_field->getType()); - $this->$setter($map_field); - break; - } - } else if ($field->getLabel() === GPBLabel::REPEATED) { - switch ($field->getType()) { - case GPBType::MESSAGE: - case GPBType::GROUP: - $repeated_field = new RepeatedField( - $field->getType(), - $field->getMessageType()->getClass()); - $this->$setter($repeated_field); - break; - case GPBType::ENUM: - $repeated_field = new RepeatedField( - $field->getType(), - $field->getEnumType()->getClass()); - $this->$setter($repeated_field); - break; - default: - $repeated_field = new RepeatedField($field->getType()); - $this->$setter($repeated_field); - break; - } - } else if ($field->getOneofIndex() !== -1) { - $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; - $oneof_name = $oneof->getName(); - $this->$oneof_name = new OneofField($oneof); - } else if ($field->getLabel() === GPBLabel::OPTIONAL && - PHP_INT_SIZE == 4) { - switch ($field->getType()) { - case GPBType::INT64: - case GPBType::UINT64: - case GPBType::FIXED64: - case GPBType::SFIXED64: - case GPBType::SINT64: - $this->$setter("0"); - } - } - } - } - - protected function readOneof($number) - { - $field = $this->desc->getFieldByNumber($number); - $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; - $oneof_name = $oneof->getName(); - $oneof_field = $this->$oneof_name; - if ($number === $oneof_field->getNumber()) { - return $oneof_field->getValue(); - } else { - return $this->defaultValue($field); - } - } - - protected function writeOneof($number, $value) - { - $field = $this->desc->getFieldByNumber($number); - $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; - $oneof_name = $oneof->getName(); - $oneof_field = $this->$oneof_name; - $oneof_field->setValue($value); - $oneof_field->setFieldName($field->getName()); - $oneof_field->setNumber($number); - } - - protected function whichOneof($oneof_name) - { - $oneof_field = $this->$oneof_name; - $number = $oneof_field->getNumber(); - if ($number == 0) { - return ""; - } - $field = $this->desc->getFieldByNumber($number); - return $field->getName(); - } - - /** - * @ignore - */ - private function defaultValue($field) - { - $value = null; - - switch ($field->getType()) { - case GPBType::DOUBLE: - case GPBType::FLOAT: - return 0.0; - case GPBType::UINT32: - case GPBType::INT32: - case GPBType::FIXED32: - case GPBType::SFIXED32: - case GPBType::SINT32: - case GPBType::ENUM: - return 0; - case GPBType::INT64: - case GPBType::UINT64: - case GPBType::FIXED64: - case GPBType::SFIXED64: - case GPBType::SINT64: - if (PHP_INT_SIZE === 4) { - return '0'; - } else { - return 0; - } - case GPBType::BOOL: - return false; - case GPBType::STRING: - case GPBType::BYTES: - return ""; - case GPBType::GROUP: - case GPBType::MESSAGE: - return null; - default: - user_error("Unsupported type."); - return false; - } - } - - /** - * @ignore - */ - private static function parseFieldFromStreamNoTag($input, $field, &$value) - { - switch ($field->getType()) { - case GPBType::DOUBLE: - if (!GPBWire::readDouble($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside double field."); - } - break; - case GPBType::FLOAT: - if (!GPBWire::readFloat($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside float field."); - } - break; - case GPBType::INT64: - if (!GPBWire::readInt64($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside int64 field."); - } - break; - case GPBType::UINT64: - if (!GPBWire::readUint64($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside uint64 field."); - } - break; - case GPBType::INT32: - if (!GPBWire::readInt32($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside int32 field."); - } - break; - case GPBType::FIXED64: - if (!GPBWire::readFixed64($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside fixed64 field."); - } - break; - case GPBType::FIXED32: - if (!GPBWire::readFixed32($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside fixed32 field."); - } - break; - case GPBType::BOOL: - if (!GPBWire::readBool($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside bool field."); - } - break; - case GPBType::STRING: - // TODO(teboring): Add utf-8 check. - if (!GPBWire::readString($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside string field."); - } - break; - case GPBType::GROUP: - echo "GROUP\xA"; - trigger_error("Not implemented.", E_ERROR); - break; - case GPBType::MESSAGE: - if ($field->isMap()) { - $value = new MapEntry($field->getMessageType()); - } else { - $klass = $field->getMessageType()->getClass(); - $value = new $klass; - } - if (!GPBWire::readMessage($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside message."); - } - break; - case GPBType::BYTES: - if (!GPBWire::readString($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside bytes field."); - } - break; - case GPBType::UINT32: - if (!GPBWire::readUint32($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside uint32 field."); - } - break; - case GPBType::ENUM: - // TODO(teboring): Check unknown enum value. - if (!GPBWire::readInt32($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside enum field."); - } - break; - case GPBType::SFIXED32: - if (!GPBWire::readSfixed32($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside sfixed32 field."); - } - break; - case GPBType::SFIXED64: - if (!GPBWire::readSfixed64($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside sfixed64 field."); - } - break; - case GPBType::SINT32: - if (!GPBWire::readSint32($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside sint32 field."); - } - break; - case GPBType::SINT64: - if (!GPBWire::readSint64($input, $value)) { - throw new GPBDecodeException( - "Unexpected EOF inside sint64 field."); - } - break; - default: - user_error("Unsupported type."); - return false; - } - return true; - } - - /** - * @ignore - */ - private function parseFieldFromStream($tag, $input, $field) - { - $value = null; - $field_type = $field->getType(); - - $value_format = GPBWire::UNKNOWN; - if (GPBWire::getTagWireType($tag) === - GPBWire::getWireType($field_type)) { - $value_format = GPBWire::NORMAL_FORMAT; - } elseif ($field->isPackable() && - GPBWire::getTagWireType($tag) === - GPBWire::WIRETYPE_LENGTH_DELIMITED) { - $value_format = GPBWire::PACKED_FORMAT; - } - - if ($value_format === GPBWire::NORMAL_FORMAT) { - self::parseFieldFromStreamNoTag($input, $field, $value); - } elseif ($value_format === GPBWire::PACKED_FORMAT) { - $length = 0; - if (!GPBWire::readInt32($input, $length)) { - throw new GPBDecodeException( - "Unexpected EOF inside packed length."); - } - $limit = $input->pushLimit($length); - $getter = $field->getGetter(); - while ($input->bytesUntilLimit() > 0) { - self::parseFieldFromStreamNoTag($input, $field, $value); - $this->$getter()[] = $value; - } - $input->popLimit($limit); - return; - } else { - return false; - } - - if ($field->isMap()) { - $getter = $field->getGetter(); - $this->$getter()[$value->getKey()] = $value->getValue(); - } else if ($field->isRepeated()) { - $getter = $field->getGetter(); - $this->$getter()[] = $value; - } else { - $setter = $field->getSetter(); - $this->$setter($value); - } - } - - /** - * Clear all containing fields. - * @return null. - */ - public function clear() - { - foreach ($this->desc->getField() as $field) { - $setter = $field->getSetter(); - if ($field->isMap()) { - $message_type = $field->getMessageType(); - $key_field = $message_type->getFieldByNumber(1); - $value_field = $message_type->getFieldByNumber(2); - switch ($value_field->getType()) { - case GPBType::MESSAGE: - case GPBType::GROUP: - $map_field = new MapField( - $key_field->getType(), - $value_field->getType(), - $value_field->getMessageType()->getClass()); - $this->$setter($map_field); - break; - case GPBType::ENUM: - $map_field = new MapField( - $key_field->getType(), - $value_field->getType(), - $value_field->getEnumType()->getClass()); - $this->$setter($map_field); - break; - default: - $map_field = new MapField( - $key_field->getType(), - $value_field->getType()); - $this->$setter($map_field); - break; - } - } else if ($field->getLabel() === GPBLabel::REPEATED) { - switch ($field->getType()) { - case GPBType::MESSAGE: - case GPBType::GROUP: - $repeated_field = new RepeatedField( - $field->getType(), - $field->getMessageType()->getClass()); - $this->$setter($repeated_field); - break; - case GPBType::ENUM: - $repeated_field = new RepeatedField( - $field->getType(), - $field->getEnumType()->getClass()); - $this->$setter($repeated_field); - break; - default: - $repeated_field = new RepeatedField($field->getType()); - $this->$setter($repeated_field); - break; - } - } else if ($field->getOneofIndex() !== -1) { - $oneof = $this->desc->getOneofDecl()[$field->getOneofIndex()]; - $oneof_name = $oneof->getName(); - $this->$oneof_name = new OneofField($oneof); - } else if ($field->getLabel() === GPBLabel::OPTIONAL) { - switch ($field->getType()) { - case GPBType::DOUBLE : - case GPBType::FLOAT : - $this->$setter(0.0); - break; - case GPBType::INT32 : - case GPBType::FIXED32 : - case GPBType::UINT32 : - case GPBType::SFIXED32 : - case GPBType::SINT32 : - case GPBType::ENUM : - $this->$setter(0); - break; - case GPBType::BOOL : - $this->$setter(false); - break; - case GPBType::STRING : - case GPBType::BYTES : - $this->$setter(""); - break; - case GPBType::GROUP : - case GPBType::MESSAGE : - $null = null; - $this->$setter($null); - break; - } - if (PHP_INT_SIZE == 4) { - switch ($field->getType()) { - case GPBType::INT64: - case GPBType::UINT64: - case GPBType::FIXED64: - case GPBType::SFIXED64: - case GPBType::SINT64: - $this->$setter("0"); - } - } else { - switch ($field->getType()) { - case GPBType::INT64: - case GPBType::UINT64: - case GPBType::FIXED64: - case GPBType::SFIXED64: - case GPBType::SINT64: - $this->$setter(0); - } - } - } - } - } - - /** - * Merges the contents of the specified message into current message. - * - * This method merges the contents of the specified message into the - * current message. Singular fields that are set in the specified message - * overwrite the corresponding fields in the current message. Repeated - * fields are appended. Map fields key-value pairs are overritten. - * Singular/Oneof sub-messages are recursively merged. All overritten - * sub-messages are deep-copied. - * - * @param object $msg Protobuf message to be merged from. - * @return null. - */ - public function mergeFrom($msg) - { - if (get_class($this) !== get_class($msg)) { - user_error("Cannot merge messages with different class."); - return; - } - - foreach ($this->desc->getField() as $field) { - $setter = $field->getSetter(); - $getter = $field->getGetter(); - if ($field->isMap()) { - if (count($msg->$getter()) != 0) { - $value_field = $field->getMessageType()->getFieldByNumber(2); - foreach ($msg->$getter() as $key => $value) { - if ($value_field->getType() == GPBType::MESSAGE) { - $klass = $value_field->getMessageType()->getClass(); - $copy = new $klass; - $copy->mergeFrom($value); - $this->$getter()[$key] = $copy; - } else { - $this->$getter()[$key] = $value; - } - } - } - } else if ($field->getLabel() === GPBLabel::REPEATED) { - if (count($msg->$getter()) != 0) { - foreach ($msg->$getter() as $tmp) { - if ($field->getType() == GPBType::MESSAGE) { - $klass = $field->getMessageType()->getClass(); - $copy = new $klass; - $copy->mergeFrom($tmp); - $this->$getter()[] = $copy; - } else { - $this->$getter()[] = $tmp; - } - } - } - } else if ($field->getLabel() === GPBLabel::OPTIONAL) { - if($msg->$getter() !== $this->defaultValue($field)) { - $tmp = $msg->$getter(); - if ($field->getType() == GPBType::MESSAGE) { - if (is_null($this->$getter())) { - $klass = $field->getMessageType()->getClass(); - $new_msg = new $klass; - $this->$setter($new_msg); - } - $this->$getter()->mergeFrom($tmp); - } else { - $this->$setter($tmp); - } - } - } - } - } - - /** - * Parses a protocol buffer contained in a string. - * - * This function takes a string in the (non-human-readable) binary wire - * format, matching the encoding output by serializeToString(). - * See mergeFrom() for merging behavior, if the field is already set in the - * specified message. - * - * @param string $data Binary protobuf data. - * @return null. - * @throws Exception Invalid data. - */ - public function mergeFromString($data) - { - $input = new InputStream($data); - $this->parseFromStream($input); - } - - /** - * @ignore - */ - public function parseFromStream($input) - { - while (true) { - $tag = $input->readTag(); - // End of input. This is a valid place to end, so return true. - if ($tag === 0) { - return true; - } - - $number = GPBWire::getTagFieldNumber($tag); - $field = $this->desc->getFieldByNumber($number); - - // Check whether we retrieved a known field - if ($field === NULL) { - continue; - } - - $this->parseFieldFromStream($tag, $input, $field); - } - } - - /** - * @ignore - */ - private function serializeSingularFieldToStream($field, &$output) - { - if (!$this->existField($field)) { - return true; - } - $getter = $field->getGetter(); - $value = $this->$getter(); - if (!GPBWire::serializeFieldToStream($value, $field, true, $output)) { - return false; - } - return true; - } - - /** - * @ignore - */ - private function serializeRepeatedFieldToStream($field, &$output) - { - $getter = $field->getGetter(); - $values = $this->$getter(); - $count = count($values); - if ($count === 0) { - return true; - } - - $packed = $field->getPacked(); - if ($packed) { - if (!GPBWire::writeTag( - $output, - GPBWire::makeTag($field->getNumber(), GPBType::STRING))) { - return false; - } - $size = 0; - foreach ($values as $value) { - $size += $this->fieldDataOnlyByteSize($field, $value); - } - if (!$output->writeVarint32($size)) { - return false; - } - } - - foreach ($values as $value) { - if (!GPBWire::serializeFieldToStream( - $value, - $field, - !$packed, - $output)) { - return false; - } - } - return true; - } - - /** - * @ignore - */ - private function serializeMapFieldToStream($field, $output) - { - $getter = $field->getGetter(); - $values = $this->$getter(); - $count = count($values); - if ($count === 0) { - return true; - } - - foreach ($values as $key => $value) { - $map_entry = new MapEntry($field->getMessageType()); - $map_entry->setKey($key); - $map_entry->setValue($value); - if (!GPBWire::serializeFieldToStream( - $map_entry, - $field, - true, - $output)) { - return false; - } - } - return true; - } - - /** - * @ignore - */ - private function serializeFieldToStream(&$output, $field) - { - if ($field->isMap()) { - return $this->serializeMapFieldToStream($field, $output); - } elseif ($field->isRepeated()) { - return $this->serializeRepeatedFieldToStream($field, $output); - } else { - return $this->serializeSingularFieldToStream($field, $output); - } - } - - /** - * @ignore - */ - public function serializeToStream(&$output) - { - $fields = $this->desc->getField(); - foreach ($fields as $field) { - if (!$this->serializeFieldToStream($output, $field)) { - return false; - } - } - return true; - } - - /** - * Serialize the message to string. - * @return string Serialized binary protobuf data. - */ - public function serializeToString() - { - $output = new OutputStream($this->byteSize()); - $this->serializeToStream($output); - return $output->getData(); - } - - /** - * @ignore - */ - private function existField($field) - { - $getter = $field->getGetter(); - $value = $this->$getter(); - return $value !== $this->defaultValue($field); - } - - /** - * @ignore - */ - private function repeatedFieldDataOnlyByteSize($field) - { - $size = 0; - - $getter = $field->getGetter(); - $values = $this->$getter(); - $count = count($values); - if ($count !== 0) { - $size += $count * GPBWire::tagSize($field); - foreach ($values as $value) { - $size += $this->singularFieldDataOnlyByteSize($field); - } - } - } - - /** - * @ignore - */ - private function fieldDataOnlyByteSize($field, $value) - { - $size = 0; - - switch ($field->getType()) { - case GPBType::BOOL: - $size += 1; - break; - case GPBType::FLOAT: - case GPBType::FIXED32: - case GPBType::SFIXED32: - $size += 4; - break; - case GPBType::DOUBLE: - case GPBType::FIXED64: - case GPBType::SFIXED64: - $size += 8; - break; - case GPBType::INT32: - case GPBType::ENUM: - $size += GPBWire::varint32Size($value, true); - break; - case GPBType::UINT32: - $size += GPBWire::varint32Size($value); - break; - case GPBType::UINT64: - case GPBType::INT64: - $size += GPBWire::varint64Size($value); - break; - case GPBType::SINT32: - $size += GPBWire::sint32Size($value); - break; - case GPBType::SINT64: - $size += GPBWire::sint64Size($value); - break; - case GPBType::STRING: - case GPBType::BYTES: - $size += strlen($value); - $size += GPBWire::varint32Size($size); - break; - case GPBType::MESSAGE: - $size += $value->byteSize(); - $size += GPBWire::varint32Size($size); - break; - case GPBType::GROUP: - // TODO(teboring): Add support. - user_error("Unsupported type."); - break; - default: - user_error("Unsupported type."); - return 0; - } - - return $size; - } - - /** - * @ignore - */ - private function fieldByteSize($field) - { - $size = 0; - if ($field->isMap()) { - $getter = $field->getGetter(); - $values = $this->$getter(); - $count = count($values); - if ($count !== 0) { - $size += $count * GPBWire::tagSize($field); - $message_type = $field->getMessageType(); - $key_field = $message_type->getFieldByNumber(1); - $value_field = $message_type->getFieldByNumber(2); - foreach ($values as $key => $value) { - $data_size = 0; - $data_size += $this->fieldDataOnlyByteSize($key_field, $key); - $data_size += $this->fieldDataOnlyByteSize( - $value_field, - $value); - $data_size += GPBWire::tagSize($key_field); - $data_size += GPBWire::tagSize($value_field); - $size += GPBWire::varint32Size($data_size) + $data_size; - } - } - } elseif ($field->isRepeated()) { - $getter = $field->getGetter(); - $values = $this->$getter(); - $count = count($values); - if ($count !== 0) { - if ($field->getPacked()) { - $data_size = 0; - foreach ($values as $value) { - $data_size += $this->fieldDataOnlyByteSize($field, $value); - } - $size += GPBWire::tagSize($field); - $size += GPBWire::varint32Size($data_size); - $size += $data_size; - } else { - $size += $count * GPBWire::tagSize($field); - foreach ($values as $value) { - $size += $this->fieldDataOnlyByteSize($field, $value); - } - } - } - } elseif ($this->existField($field)) { - $size += GPBWire::tagSize($field); - $getter = $field->getGetter(); - $value = $this->$getter(); - $size += $this->fieldDataOnlyByteSize($field, $value); - } - return $size; - } - - /** - * @ignore - */ - public function byteSize() - { - $size = 0; - - $fields = $this->desc->getField(); - foreach ($fields as $field) { - $size += $this->fieldByteSize($field); - } - return $size; - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php deleted file mode 100644 index 2724d2673d..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MessageBuilderContext.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBLabel; -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\Descriptor; -use Google\Protobuf\Internal\FieldDescriptor; - -class MessageBuilderContext -{ - - private $descriptor; - private $pool; - - public function __construct($full_name, $klass, $pool) - { - $this->descriptor = new Descriptor(); - $this->descriptor->setFullName($full_name); - $this->descriptor->setClass($klass); - $this->pool = $pool; - } - - private function getFieldDescriptor($name, $label, $type, - $number, $type_name = null) - { - $field = new FieldDescriptor(); - $field->setName($name); - $camel_name = implode('', array_map('ucwords', explode('_', $name))); - $field->setGetter('get' . $camel_name); - $field->setSetter('set' . $camel_name); - $field->setType($type); - $field->setNumber($number); - $field->setLabel($label); - - // At this time, the message/enum type may have not been added to pool. - // So we use the type name as place holder and will replace it with the - // actual descriptor in cross building. - switch ($type) { - case GPBType::MESSAGE: - $field->setMessageType($type_name); - break; - case GPBType::ENUM: - $field->setEnumType($type_name); - break; - default: - break; - } - - return $field; - } - - public function optional($name, $type, $number, $type_name = null) - { - $this->descriptor->addField($this->getFieldDescriptor( - $name, - GPBLabel::OPTIONAL, - $type, - $number, - $type_name)); - return $this; - } - - public function repeated($name, $type, $number, $type_name = null) - { - $this->descriptor->addField($this->getFieldDescriptor( - $name, - GPBLabel::REPEATED, - $type, - $number, - $type_name)); - return $this; - } - - public function required($name, $type, $number, $type_name = null) - { - $this->descriptor->addField($this->getFieldDescriptor( - $name, - GPBLabel::REQUIRED, - $type, - $number, - $type_name)); - return $this; - } - - public function finalizeToPool() - { - $this->pool->addDescriptor($this->descriptor); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MessageOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MessageOptions.php deleted file mode 100644 index 747f32947b..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MessageOptions.php +++ /dev/null @@ -1,334 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.MessageOptions</code> - */ -class MessageOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Set true to use the old proto1 MessageSet wire format for extensions. - * This is provided for backwards-compatibility with the MessageSet wire - * format. You should not use this for any other reason: It's less - * efficient, has fewer features, and is more complicated. - * The message must be defined exactly as follows: - * message Foo { - * option message_set_wire_format = true; - * extensions 4 to max; - * } - * Note that the message cannot have any defined fields; MessageSets only - * have extensions. - * All extensions of your type must be singular messages; e.g. they cannot - * be int32s, enums, or repeated messages. - * Because this is an option, the above two restrictions are not enforced by - * the protocol compiler. - * </pre> - * - * <code>optional bool message_set_wire_format = 1 [default = false];</code> - */ - private $message_set_wire_format = false; - private $has_message_set_wire_format = false; - /** - * <pre> - * Disables the generation of the standard "descriptor()" accessor, which can - * conflict with a field of the same name. This is meant to make migration - * from proto1 easier; new code should avoid fields named "descriptor". - * </pre> - * - * <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code> - */ - private $no_standard_descriptor_accessor = false; - private $has_no_standard_descriptor_accessor = false; - /** - * <pre> - * Is this message deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the message, or it will be completely ignored; in the very least, - * this is a formalization for deprecating messages. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <pre> - * Whether the message is an automatically generated map entry type for the - * maps field. - * For maps fields: - * map<KeyType, ValueType> map_field = 1; - * The parsed descriptor looks like: - * message MapFieldEntry { - * option map_entry = true; - * optional KeyType key = 1; - * optional ValueType value = 2; - * } - * repeated MapFieldEntry map_field = 1; - * Implementations may choose not to generate the map_entry=true message, but - * use a native map in the target language to hold the keys and values. - * The reflection APIs in such implementions still need to work as - * if the field is a repeated message field. - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. - * </pre> - * - * <code>optional bool map_entry = 7;</code> - */ - private $map_entry = false; - private $has_map_entry = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Set true to use the old proto1 MessageSet wire format for extensions. - * This is provided for backwards-compatibility with the MessageSet wire - * format. You should not use this for any other reason: It's less - * efficient, has fewer features, and is more complicated. - * The message must be defined exactly as follows: - * message Foo { - * option message_set_wire_format = true; - * extensions 4 to max; - * } - * Note that the message cannot have any defined fields; MessageSets only - * have extensions. - * All extensions of your type must be singular messages; e.g. they cannot - * be int32s, enums, or repeated messages. - * Because this is an option, the above two restrictions are not enforced by - * the protocol compiler. - * </pre> - * - * <code>optional bool message_set_wire_format = 1 [default = false];</code> - */ - public function getMessageSetWireFormat() - { - return $this->message_set_wire_format; - } - - /** - * <pre> - * Set true to use the old proto1 MessageSet wire format for extensions. - * This is provided for backwards-compatibility with the MessageSet wire - * format. You should not use this for any other reason: It's less - * efficient, has fewer features, and is more complicated. - * The message must be defined exactly as follows: - * message Foo { - * option message_set_wire_format = true; - * extensions 4 to max; - * } - * Note that the message cannot have any defined fields; MessageSets only - * have extensions. - * All extensions of your type must be singular messages; e.g. they cannot - * be int32s, enums, or repeated messages. - * Because this is an option, the above two restrictions are not enforced by - * the protocol compiler. - * </pre> - * - * <code>optional bool message_set_wire_format = 1 [default = false];</code> - */ - public function setMessageSetWireFormat($var) - { - GPBUtil::checkBool($var); - $this->message_set_wire_format = $var; - $this->has_message_set_wire_format = true; - } - - public function hasMessageSetWireFormat() - { - return $this->has_message_set_wire_format; - } - - /** - * <pre> - * Disables the generation of the standard "descriptor()" accessor, which can - * conflict with a field of the same name. This is meant to make migration - * from proto1 easier; new code should avoid fields named "descriptor". - * </pre> - * - * <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code> - */ - public function getNoStandardDescriptorAccessor() - { - return $this->no_standard_descriptor_accessor; - } - - /** - * <pre> - * Disables the generation of the standard "descriptor()" accessor, which can - * conflict with a field of the same name. This is meant to make migration - * from proto1 easier; new code should avoid fields named "descriptor". - * </pre> - * - * <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code> - */ - public function setNoStandardDescriptorAccessor($var) - { - GPBUtil::checkBool($var); - $this->no_standard_descriptor_accessor = $var; - $this->has_no_standard_descriptor_accessor = true; - } - - public function hasNoStandardDescriptorAccessor() - { - return $this->has_no_standard_descriptor_accessor; - } - - /** - * <pre> - * Is this message deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the message, or it will be completely ignored; in the very least, - * this is a formalization for deprecating messages. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this message deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the message, or it will be completely ignored; in the very least, - * this is a formalization for deprecating messages. - * </pre> - * - * <code>optional bool deprecated = 3 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <pre> - * Whether the message is an automatically generated map entry type for the - * maps field. - * For maps fields: - * map<KeyType, ValueType> map_field = 1; - * The parsed descriptor looks like: - * message MapFieldEntry { - * option map_entry = true; - * optional KeyType key = 1; - * optional ValueType value = 2; - * } - * repeated MapFieldEntry map_field = 1; - * Implementations may choose not to generate the map_entry=true message, but - * use a native map in the target language to hold the keys and values. - * The reflection APIs in such implementions still need to work as - * if the field is a repeated message field. - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. - * </pre> - * - * <code>optional bool map_entry = 7;</code> - */ - public function getMapEntry() - { - return $this->map_entry; - } - - /** - * <pre> - * Whether the message is an automatically generated map entry type for the - * maps field. - * For maps fields: - * map<KeyType, ValueType> map_field = 1; - * The parsed descriptor looks like: - * message MapFieldEntry { - * option map_entry = true; - * optional KeyType key = 1; - * optional ValueType value = 2; - * } - * repeated MapFieldEntry map_field = 1; - * Implementations may choose not to generate the map_entry=true message, but - * use a native map in the target language to hold the keys and values. - * The reflection APIs in such implementions still need to work as - * if the field is a repeated message field. - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. - * </pre> - * - * <code>optional bool map_entry = 7;</code> - */ - public function setMapEntry($var) - { - GPBUtil::checkBool($var); - $this->map_entry = $var; - $this->has_map_entry = true; - } - - public function hasMapEntry() - { - return $this->has_map_entry; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php deleted file mode 100644 index 3d8df7af73..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a method of a service. - * </pre> - * - * Protobuf type <code>google.protobuf.MethodDescriptorProto</code> - */ -class MethodDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <pre> - * Input and output type names. These are resolved in the same way as - * FieldDescriptorProto.type_name, but must refer to a message type. - * </pre> - * - * <code>optional string input_type = 2;</code> - */ - private $input_type = ''; - private $has_input_type = false; - /** - * <code>optional string output_type = 3;</code> - */ - private $output_type = ''; - private $has_output_type = false; - /** - * <code>optional .google.protobuf.MethodOptions options = 4;</code> - */ - private $options = null; - private $has_options = false; - /** - * <pre> - * Identifies if client streams multiple client messages - * </pre> - * - * <code>optional bool client_streaming = 5 [default = false];</code> - */ - private $client_streaming = false; - private $has_client_streaming = false; - /** - * <pre> - * Identifies if server streams multiple server messages - * </pre> - * - * <code>optional bool server_streaming = 6 [default = false];</code> - */ - private $server_streaming = false; - private $has_server_streaming = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <pre> - * Input and output type names. These are resolved in the same way as - * FieldDescriptorProto.type_name, but must refer to a message type. - * </pre> - * - * <code>optional string input_type = 2;</code> - */ - public function getInputType() - { - return $this->input_type; - } - - /** - * <pre> - * Input and output type names. These are resolved in the same way as - * FieldDescriptorProto.type_name, but must refer to a message type. - * </pre> - * - * <code>optional string input_type = 2;</code> - */ - public function setInputType($var) - { - GPBUtil::checkString($var, True); - $this->input_type = $var; - $this->has_input_type = true; - } - - public function hasInputType() - { - return $this->has_input_type; - } - - /** - * <code>optional string output_type = 3;</code> - */ - public function getOutputType() - { - return $this->output_type; - } - - /** - * <code>optional string output_type = 3;</code> - */ - public function setOutputType($var) - { - GPBUtil::checkString($var, True); - $this->output_type = $var; - $this->has_output_type = true; - } - - public function hasOutputType() - { - return $this->has_output_type; - } - - /** - * <code>optional .google.protobuf.MethodOptions options = 4;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.MethodOptions options = 4;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\MethodOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - - /** - * <pre> - * Identifies if client streams multiple client messages - * </pre> - * - * <code>optional bool client_streaming = 5 [default = false];</code> - */ - public function getClientStreaming() - { - return $this->client_streaming; - } - - /** - * <pre> - * Identifies if client streams multiple client messages - * </pre> - * - * <code>optional bool client_streaming = 5 [default = false];</code> - */ - public function setClientStreaming($var) - { - GPBUtil::checkBool($var); - $this->client_streaming = $var; - $this->has_client_streaming = true; - } - - public function hasClientStreaming() - { - return $this->has_client_streaming; - } - - /** - * <pre> - * Identifies if server streams multiple server messages - * </pre> - * - * <code>optional bool server_streaming = 6 [default = false];</code> - */ - public function getServerStreaming() - { - return $this->server_streaming; - } - - /** - * <pre> - * Identifies if server streams multiple server messages - * </pre> - * - * <code>optional bool server_streaming = 6 [default = false];</code> - */ - public function setServerStreaming($var) - { - GPBUtil::checkBool($var); - $this->server_streaming = $var; - $this->has_server_streaming = true; - } - - public function hasServerStreaming() - { - return $this->has_server_streaming; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodOptions.php deleted file mode 100644 index 6dca58540b..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodOptions.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.MethodOptions</code> - */ -class MethodOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Is this method deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the method, or it will be completely ignored; in the very least, - * this is a formalization for deprecating methods. - * </pre> - * - * <code>optional bool deprecated = 33 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code> - */ - private $idempotency_level = 0; - private $has_idempotency_level = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Is this method deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the method, or it will be completely ignored; in the very least, - * this is a formalization for deprecating methods. - * </pre> - * - * <code>optional bool deprecated = 33 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this method deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the method, or it will be completely ignored; in the very least, - * this is a formalization for deprecating methods. - * </pre> - * - * <code>optional bool deprecated = 33 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code> - */ - public function getIdempotencyLevel() - { - return $this->idempotency_level; - } - - /** - * <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code> - */ - public function setIdempotencyLevel($var) - { - GPBUtil::checkEnum($var, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class); - $this->idempotency_level = $var; - $this->has_idempotency_level = true; - } - - public function hasIdempotencyLevel() - { - return $this->has_idempotency_level; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php deleted file mode 100644 index ce4adfe7c4..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -/** - * <pre> - * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - * or neither? HTTP based RPC implementation may choose GET verb for safe - * methods, and PUT verb for idempotent methods instead of the default POST. - * </pre> - * - * Protobuf enum <code>google.protobuf.MethodOptions.IdempotencyLevel</code> - */ -class MethodOptions_IdempotencyLevel -{ - /** - * <code>IDEMPOTENCY_UNKNOWN = 0;</code> - */ - const IDEMPOTENCY_UNKNOWN = 0; - /** - * <pre> - * implies idempotent - * </pre> - * - * <code>NO_SIDE_EFFECTS = 1;</code> - */ - const NO_SIDE_EFFECTS = 1; - /** - * <pre> - * idempotent, but may have side effects - * </pre> - * - * <code>IDEMPOTENT = 2;</code> - */ - const IDEMPOTENT = 2; -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php deleted file mode 100644 index e5fbe37065..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a oneof. - * </pre> - * - * Protobuf type <code>google.protobuf.OneofDescriptorProto</code> - */ -class OneofDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <code>optional .google.protobuf.OneofOptions options = 2;</code> - */ - private $options = null; - private $has_options = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <code>optional .google.protobuf.OneofOptions options = 2;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.OneofOptions options = 2;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofField.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofField.php deleted file mode 100644 index 2c689e836c..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofField.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -class OneofField -{ - - private $desc; - private $field_name; - private $number = 0; - private $value; - - public function __construct($desc) - { - $this->desc = $desc; - } - - public function setValue($value) - { - $this->value = $value; - } - - public function getValue() - { - return $this->value; - } - - public function setFieldName($field_name) - { - $this->field_name = $field_name; - } - - public function getFieldName() - { - return $this->field_name; - } - - public function setNumber($number) - { - $this->number = $number; - } - - public function getNumber() - { - return $this->number; - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofOptions.php deleted file mode 100644 index b61325d29e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OneofOptions.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.OneofOptions</code> - */ -class OneofOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php deleted file mode 100644 index 8c6d9b6807..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/OutputStream.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -class OutputStream -{ - - private $buffer; - private $buffer_size; - private $current; - - const MAX_VARINT64_BYTES = 10; - - public function __construct($size) - { - $this->current = 0; - $this->buffer_size = $size; - $this->buffer = str_repeat(chr(0), $this->buffer_size); - } - - public function getData() - { - return $this->buffer; - } - - public function writeVarint32($value) - { - $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); - $size = self::writeVarintToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeVarint64($value) - { - $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); - $size = self::writeVarintToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeLittleEndian32($value) - { - $bytes = str_repeat(chr(0), 4); - $size = self::writeLittleEndian32ToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeLittleEndian64($value) - { - $bytes = str_repeat(chr(0), 8); - $size = self::writeLittleEndian64ToArray($value, $bytes); - return $this->writeRaw($bytes, $size); - } - - public function writeTag($tag) - { - return $this->writeVarint32($tag); - } - - public function writeRaw($data, $size) - { - if ($this->buffer_size < $size) { - trigger_error("Output stream doesn't have enough buffer."); - return false; - } - - for ($i = 0; $i < $size; $i++) { - $this->buffer[$this->current] = $data[$i]; - $this->current++; - $this->buffer_size--; - } - return true; - } - - private static function writeVarintToArray($value, &$buffer) - { - $current = 0; - - $high = 0; - $low = 0; - if (PHP_INT_SIZE == 4) { - GPBUtil::divideInt64ToInt32($value, $high, $low); - } else { - $low = $value; - } - - while ($low >= 0x80 || $low < 0) { - $buffer[$current] = chr($low | 0x80); - $value = ($value >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); - $carry = ($high & 0x7F) << ((PHP_INT_SIZE << 3) - 7); - $high = ($high >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); - $low = (($low >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)) | $carry); - $current++; - } - $buffer[$current] = chr($low); - return $current + 1; - } - - private static function writeLittleEndian32ToArray($value, &$buffer) - { - $buffer[0] = chr($value & 0x000000FF); - $buffer[1] = chr(($value >> 8) & 0x000000FF); - $buffer[2] = chr(($value >> 16) & 0x000000FF); - $buffer[3] = chr(($value >> 24) & 0x000000FF); - return 4; - } - - private static function writeLittleEndian64ToArray($value, &$buffer) - { - $high = 0; - $low = 0; - if (PHP_INT_SIZE == 4) { - GPBUtil::divideInt64ToInt32($value, $high, $low); - } else { - $low = $value & 0xFFFFFFFF; - $high = ($value >> 32) & 0xFFFFFFFF; - } - - $buffer[0] = chr($low & 0x000000FF); - $buffer[1] = chr(($low >> 8) & 0x000000FF); - $buffer[2] = chr(($low >> 16) & 0x000000FF); - $buffer[3] = chr(($low >> 24) & 0x000000FF); - $buffer[4] = chr($high & 0x000000FF); - $buffer[5] = chr(($high >> 8) & 0x000000FF); - $buffer[6] = chr(($high >> 16) & 0x000000FF); - $buffer[7] = chr(($high >> 24) & 0x000000FF); - return 8; - } - -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/RepeatedField.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/RepeatedField.php deleted file mode 100644 index 2ad4709a67..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/RepeatedField.php +++ /dev/null @@ -1,307 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/** - * RepeatedField and RepeatedFieldIter are used by generated protocol message - * classes to manipulate repeated fields. - */ - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBUtil; - -/** - * RepeatedFieldIter is used to iterate RepeatedField. It is also need for the - * foreach syntax. - */ -class RepeatedFieldIter implements \Iterator -{ - - /** - * @ignore - */ - private $position; - /** - * @ignore - */ - private $container; - - /** - * Create iterator instance for RepeatedField. - * - * @param RepeatedField The RepeatedField instance for which this iterator - * is created. - * @ignore - */ - public function __construct($container) - { - $this->position = 0; - $this->container = $container; - } - - /** - * Reset the status of the iterator - * - * @return void - */ - public function rewind() - { - $this->position = 0; - } - - /** - * Return the element at the current position. - * - * @return object The element at the current position. - */ - public function current() - { - return $this->container[$this->position]; - } - - /** - * Return the current position. - * - * @return integer The current position. - */ - public function key() - { - return $this->position; - } - - /** - * Move to the next position. - * - * @return void - */ - public function next() - { - ++$this->position; - } - - /** - * Check whether there are more elements to iterate. - * - * @return bool True if there are more elements to iterate. - */ - public function valid() - { - return isset($this->container[$this->position]); - } -} - -/** - * RepeatedField is used by generated protocol message classes to manipulate - * repeated fields. It can be used like native PHP array. - */ -class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable -{ - - /** - * @ignore - */ - private $container; - /** - * @ignore - */ - private $type; - /** - * @ignore - */ - private $klass; - - /** - * Constructs an instance of RepeatedField. - * - * @param long $type Type of the stored element. - * @param string $klass Message/Enum class name (message/enum fields only). - * @ignore - */ - public function __construct($type, $klass = null) - { - $this->container = []; - $this->type = $type; - $this->klass = $klass; - } - - /** - * @ignore - */ - public function getType() - { - return $this->type; - } - - /** - * @ignore - */ - public function getClass() - { - return $this->klass; - } - - /** - * Return the element at the given index. - * - * This will also be called for: $ele = $arr[0] - * - * @param long $offset The index of the element to be fetched. - * @return object The stored element at given index. - * @throws ErrorException Invalid type for index. - * @throws ErrorException Non-existing index. - */ - public function offsetGet($offset) - { - return $this->container[$offset]; - } - - /** - * Assign the element at the given index. - * - * This will also be called for: $arr []= $ele and $arr[0] = ele - * - * @param long $offset The index of the element to be assigned. - * @param object $value The element to be assigned. - * @return void - * @throws ErrorException Invalid type for index. - * @throws ErrorException Non-existing index. - * @throws ErrorException Incorrect type of the element. - */ - public function offsetSet($offset, $value) - { - switch ($this->type) { - case GPBType::INT32: - GPBUtil::checkInt32($value); - break; - case GPBType::UINT32: - GPBUtil::checkUint32($value); - break; - case GPBType::INT64: - GPBUtil::checkInt64($value); - break; - case GPBType::UINT64: - GPBUtil::checkUint64($value); - break; - case GPBType::FLOAT: - GPBUtil::checkFloat($value); - break; - case GPBType::DOUBLE: - GPBUtil::checkDouble($value); - break; - case GPBType::BOOL: - GPBUtil::checkBool($value); - break; - case GPBType::STRING: - GPBUtil::checkString($value, true); - break; - case GPBType::MESSAGE: - if (is_null($value)) { - trigger_error("RepeatedField element cannot be null.", - E_USER_ERROR); - } - GPBUtil::checkMessage($value, $this->klass); - break; - default: - break; - } - if (is_null($offset)) { - $this->container[] = $value; - } else { - $count = count($this->container); - if (!is_numeric($offset) || $offset < 0 || $offset >= $count) { - trigger_error( - "Cannot modify element at the given index", - E_USER_ERROR); - return; - } - $this->container[$offset] = $value; - } - } - - /** - * Remove the element at the given index. - * - * This will also be called for: unset($arr) - * - * @param long $offset The index of the element to be removed. - * @return void - * @throws ErrorException Invalid type for index. - * @throws ErrorException The element to be removed is not at the end of the - * RepeatedField. - */ - public function offsetUnset($offset) - { - $count = count($this->container); - if (!is_numeric($offset) || $count === 0 || $offset !== $count - 1) { - trigger_error( - "Cannot remove element at the given index", - E_USER_ERROR); - return; - } - array_pop($this->container); - } - - /** - * Check the existence of the element at the given index. - * - * This will also be called for: isset($arr) - * - * @param long $offset The index of the element to be removed. - * @return bool True if the element at the given offset exists. - * @throws ErrorException Invalid type for index. - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * @ignore - */ - public function getIterator() - { - return new RepeatedFieldIter($this->container); - } - - /** - * Return the number of stored elements. - * - * This will also be called for: count($arr) - * - * @return integer The number of stored elements. - */ - public function count() - { - return count($this->container); - } -} diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php deleted file mode 100644 index 4777620262..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Describes a service. - * </pre> - * - * Protobuf type <code>google.protobuf.ServiceDescriptorProto</code> - */ -class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message -{ - /** - * <code>optional string name = 1;</code> - */ - private $name = ''; - private $has_name = false; - /** - * <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code> - */ - private $method; - private $has_method = false; - /** - * <code>optional .google.protobuf.ServiceOptions options = 3;</code> - */ - private $options = null; - private $has_options = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>optional string name = 1;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>optional string name = 1;</code> - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code> - */ - public function getMethod() - { - return $this->method; - } - - /** - * <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code> - */ - public function setMethod(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); - $this->method = $arr; - $this->has_method = true; - } - - public function hasMethod() - { - return $this->has_method; - } - - /** - * <code>optional .google.protobuf.ServiceOptions options = 3;</code> - */ - public function getOptions() - { - return $this->options; - } - - /** - * <code>optional .google.protobuf.ServiceOptions options = 3;</code> - */ - public function setOptions(&$var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class); - $this->options = $var; - $this->has_options = true; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/ServiceOptions.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/ServiceOptions.php deleted file mode 100644 index 62323dbad1..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/ServiceOptions.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.ServiceOptions</code> - */ -class ServiceOptions extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Is this service deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the service, or it will be completely ignored; in the very least, - * this is a formalization for deprecating services. - * </pre> - * - * <code>optional bool deprecated = 33 [default = false];</code> - */ - private $deprecated = false; - private $has_deprecated = false; - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - private $uninterpreted_option; - private $has_uninterpreted_option = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Is this service deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the service, or it will be completely ignored; in the very least, - * this is a formalization for deprecating services. - * </pre> - * - * <code>optional bool deprecated = 33 [default = false];</code> - */ - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * <pre> - * Is this service deprecated? - * Depending on the target platform, this can emit Deprecated annotations - * for the service, or it will be completely ignored; in the very least, - * this is a formalization for deprecating services. - * </pre> - * - * <code>optional bool deprecated = 33 [default = false];</code> - */ - public function setDeprecated($var) - { - GPBUtil::checkBool($var); - $this->deprecated = $var; - $this->has_deprecated = true; - } - - public function hasDeprecated() - { - return $this->has_deprecated; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function getUninterpretedOption() - { - return $this->uninterpreted_option; - } - - /** - * <pre> - * The parser stores options it doesn't recognize here. See above. - * </pre> - * - * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> - */ - public function setUninterpretedOption(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $arr; - $this->has_uninterpreted_option = true; - } - - public function hasUninterpretedOption() - { - return $this->has_uninterpreted_option; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php deleted file mode 100644 index eab6088033..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ /dev/null @@ -1,191 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * Encapsulates information about the original source file from which a - * FileDescriptorProto was generated. - * </pre> - * - * Protobuf type <code>google.protobuf.SourceCodeInfo</code> - */ -class SourceCodeInfo extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * A Location identifies a piece of source code in a .proto file which - * corresponds to a particular definition. This information is intended - * to be useful to IDEs, code indexers, documentation generators, and similar - * tools. - * For example, say we have a file like: - * message Foo { - * optional string foo = 1; - * } - * Let's look at just the field definition: - * optional string foo = 1; - * ^ ^^ ^^ ^ ^^^ - * a bc de f ghi - * We have the following locations: - * span path represents - * [a,i) [ 4, 0, 2, 0 ] The whole field definition. - * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - * Notes: - * - A location may refer to a repeated field itself (i.e. not to any - * particular index within it). This is used whenever a set of elements are - * logically enclosed in a single code segment. For example, an entire - * extend block (possibly containing multiple extension definitions) will - * have an outer location whose path refers to the "extensions" repeated - * field without an index. - * - Multiple locations may have the same path. This happens when a single - * logical declaration is spread out across multiple places. The most - * obvious example is the "extend" block again -- there may be multiple - * extend blocks in the same scope, each of which will have the same path. - * - A location's span is not always a subset of its parent's span. For - * example, the "extendee" of an extension declaration appears at the - * beginning of the "extend" block and is shared by all extensions within - * the block. - * - Just because a location's span is a subset of some other location's span - * does not mean that it is a descendent. For example, a "group" defines - * both a type and a field in a single declaration. Thus, the locations - * corresponding to the type and field and their components will overlap. - * - Code which tries to interpret locations should probably be designed to - * ignore those that it doesn't understand, as more types of locations could - * be recorded in the future. - * </pre> - * - * <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code> - */ - private $location; - private $has_location = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * A Location identifies a piece of source code in a .proto file which - * corresponds to a particular definition. This information is intended - * to be useful to IDEs, code indexers, documentation generators, and similar - * tools. - * For example, say we have a file like: - * message Foo { - * optional string foo = 1; - * } - * Let's look at just the field definition: - * optional string foo = 1; - * ^ ^^ ^^ ^ ^^^ - * a bc de f ghi - * We have the following locations: - * span path represents - * [a,i) [ 4, 0, 2, 0 ] The whole field definition. - * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - * Notes: - * - A location may refer to a repeated field itself (i.e. not to any - * particular index within it). This is used whenever a set of elements are - * logically enclosed in a single code segment. For example, an entire - * extend block (possibly containing multiple extension definitions) will - * have an outer location whose path refers to the "extensions" repeated - * field without an index. - * - Multiple locations may have the same path. This happens when a single - * logical declaration is spread out across multiple places. The most - * obvious example is the "extend" block again -- there may be multiple - * extend blocks in the same scope, each of which will have the same path. - * - A location's span is not always a subset of its parent's span. For - * example, the "extendee" of an extension declaration appears at the - * beginning of the "extend" block and is shared by all extensions within - * the block. - * - Just because a location's span is a subset of some other location's span - * does not mean that it is a descendent. For example, a "group" defines - * both a type and a field in a single declaration. Thus, the locations - * corresponding to the type and field and their components will overlap. - * - Code which tries to interpret locations should probably be designed to - * ignore those that it doesn't understand, as more types of locations could - * be recorded in the future. - * </pre> - * - * <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code> - */ - public function getLocation() - { - return $this->location; - } - - /** - * <pre> - * A Location identifies a piece of source code in a .proto file which - * corresponds to a particular definition. This information is intended - * to be useful to IDEs, code indexers, documentation generators, and similar - * tools. - * For example, say we have a file like: - * message Foo { - * optional string foo = 1; - * } - * Let's look at just the field definition: - * optional string foo = 1; - * ^ ^^ ^^ ^ ^^^ - * a bc de f ghi - * We have the following locations: - * span path represents - * [a,i) [ 4, 0, 2, 0 ] The whole field definition. - * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - * Notes: - * - A location may refer to a repeated field itself (i.e. not to any - * particular index within it). This is used whenever a set of elements are - * logically enclosed in a single code segment. For example, an entire - * extend block (possibly containing multiple extension definitions) will - * have an outer location whose path refers to the "extensions" repeated - * field without an index. - * - Multiple locations may have the same path. This happens when a single - * logical declaration is spread out across multiple places. The most - * obvious example is the "extend" block again -- there may be multiple - * extend blocks in the same scope, each of which will have the same path. - * - A location's span is not always a subset of its parent's span. For - * example, the "extendee" of an extension declaration appears at the - * beginning of the "extend" block and is shared by all extensions within - * the block. - * - Just because a location's span is a subset of some other location's span - * does not mean that it is a descendent. For example, a "group" defines - * both a type and a field in a single declaration. Thus, the locations - * corresponding to the type and field and their components will overlap. - * - Code which tries to interpret locations should probably be designed to - * ignore those that it doesn't understand, as more types of locations could - * be recorded in the future. - * </pre> - * - * <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code> - */ - public function setLocation(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); - $this->location = $arr; - $this->has_location = true; - } - - public function hasLocation() - { - return $this->has_location; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php deleted file mode 100644 index 5a02b26c41..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ /dev/null @@ -1,379 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * Protobuf type <code>google.protobuf.SourceCodeInfo.Location</code> - */ -class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message -{ - /** - * <pre> - * Identifies which part of the FileDescriptorProto was defined at this - * location. - * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * </pre> - * - * <code>repeated int32 path = 1 [packed = true];</code> - */ - private $path; - private $has_path = false; - /** - * <pre> - * Always has exactly three or four elements: start line, start column, - * end line (optional, otherwise assumed same as start line), end column. - * These are packed into a single field for efficiency. Note that line - * and column numbers are zero-based -- typically you will want to add - * 1 to each before displaying to a user. - * </pre> - * - * <code>repeated int32 span = 2 [packed = true];</code> - */ - private $span; - private $has_span = false; - /** - * <pre> - * If this SourceCodeInfo represents a complete declaration, these are any - * comments appearing before and after the declaration which appear to be - * attached to the declaration. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * </pre> - * - * <code>optional string leading_comments = 3;</code> - */ - private $leading_comments = ''; - private $has_leading_comments = false; - /** - * <code>optional string trailing_comments = 4;</code> - */ - private $trailing_comments = ''; - private $has_trailing_comments = false; - /** - * <code>repeated string leading_detached_comments = 6;</code> - */ - private $leading_detached_comments; - private $has_leading_detached_comments = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <pre> - * Identifies which part of the FileDescriptorProto was defined at this - * location. - * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * </pre> - * - * <code>repeated int32 path = 1 [packed = true];</code> - */ - public function getPath() - { - return $this->path; - } - - /** - * <pre> - * Identifies which part of the FileDescriptorProto was defined at this - * location. - * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * </pre> - * - * <code>repeated int32 path = 1 [packed = true];</code> - */ - public function setPath(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->path = $arr; - $this->has_path = true; - } - - public function hasPath() - { - return $this->has_path; - } - - /** - * <pre> - * Always has exactly three or four elements: start line, start column, - * end line (optional, otherwise assumed same as start line), end column. - * These are packed into a single field for efficiency. Note that line - * and column numbers are zero-based -- typically you will want to add - * 1 to each before displaying to a user. - * </pre> - * - * <code>repeated int32 span = 2 [packed = true];</code> - */ - public function getSpan() - { - return $this->span; - } - - /** - * <pre> - * Always has exactly three or four elements: start line, start column, - * end line (optional, otherwise assumed same as start line), end column. - * These are packed into a single field for efficiency. Note that line - * and column numbers are zero-based -- typically you will want to add - * 1 to each before displaying to a user. - * </pre> - * - * <code>repeated int32 span = 2 [packed = true];</code> - */ - public function setSpan(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->span = $arr; - $this->has_span = true; - } - - public function hasSpan() - { - return $this->has_span; - } - - /** - * <pre> - * If this SourceCodeInfo represents a complete declaration, these are any - * comments appearing before and after the declaration which appear to be - * attached to the declaration. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * </pre> - * - * <code>optional string leading_comments = 3;</code> - */ - public function getLeadingComments() - { - return $this->leading_comments; - } - - /** - * <pre> - * If this SourceCodeInfo represents a complete declaration, these are any - * comments appearing before and after the declaration which appear to be - * attached to the declaration. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * </pre> - * - * <code>optional string leading_comments = 3;</code> - */ - public function setLeadingComments($var) - { - GPBUtil::checkString($var, True); - $this->leading_comments = $var; - $this->has_leading_comments = true; - } - - public function hasLeadingComments() - { - return $this->has_leading_comments; - } - - /** - * <code>optional string trailing_comments = 4;</code> - */ - public function getTrailingComments() - { - return $this->trailing_comments; - } - - /** - * <code>optional string trailing_comments = 4;</code> - */ - public function setTrailingComments($var) - { - GPBUtil::checkString($var, True); - $this->trailing_comments = $var; - $this->has_trailing_comments = true; - } - - public function hasTrailingComments() - { - return $this->has_trailing_comments; - } - - /** - * <code>repeated string leading_detached_comments = 6;</code> - */ - public function getLeadingDetachedComments() - { - return $this->leading_detached_comments; - } - - /** - * <code>repeated string leading_detached_comments = 6;</code> - */ - public function setLeadingDetachedComments(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->leading_detached_comments = $arr; - $this->has_leading_detached_comments = true; - } - - public function hasLeadingDetachedComments() - { - return $this->has_leading_detached_comments; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php deleted file mode 100644 index 286550198e..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ /dev/null @@ -1,246 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * A message representing a option the parser does not recognize. This only - * appears in options protos created by the compiler::Parser class. - * DescriptorPool resolves these when building Descriptor objects. Therefore, - * options protos in descriptor objects (e.g. returned by Descriptor::options(), - * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions - * in them. - * </pre> - * - * Protobuf type <code>google.protobuf.UninterpretedOption</code> - */ -class UninterpretedOption extends \Google\Protobuf\Internal\Message -{ - /** - * <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code> - */ - private $name; - private $has_name = false; - /** - * <pre> - * The value of the uninterpreted option, in whatever type the tokenizer - * identified it as during parsing. Exactly one of these should be set. - * </pre> - * - * <code>optional string identifier_value = 3;</code> - */ - private $identifier_value = ''; - private $has_identifier_value = false; - /** - * <code>optional uint64 positive_int_value = 4;</code> - */ - private $positive_int_value = 0; - private $has_positive_int_value = false; - /** - * <code>optional int64 negative_int_value = 5;</code> - */ - private $negative_int_value = 0; - private $has_negative_int_value = false; - /** - * <code>optional double double_value = 6;</code> - */ - private $double_value = 0.0; - private $has_double_value = false; - /** - * <code>optional bytes string_value = 7;</code> - */ - private $string_value = ''; - private $has_string_value = false; - /** - * <code>optional string aggregate_value = 8;</code> - */ - private $aggregate_value = ''; - private $has_aggregate_value = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code> - */ - public function getName() - { - return $this->name; - } - - /** - * <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code> - */ - public function setName(&$var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); - $this->name = $arr; - $this->has_name = true; - } - - public function hasName() - { - return $this->has_name; - } - - /** - * <pre> - * The value of the uninterpreted option, in whatever type the tokenizer - * identified it as during parsing. Exactly one of these should be set. - * </pre> - * - * <code>optional string identifier_value = 3;</code> - */ - public function getIdentifierValue() - { - return $this->identifier_value; - } - - /** - * <pre> - * The value of the uninterpreted option, in whatever type the tokenizer - * identified it as during parsing. Exactly one of these should be set. - * </pre> - * - * <code>optional string identifier_value = 3;</code> - */ - public function setIdentifierValue($var) - { - GPBUtil::checkString($var, True); - $this->identifier_value = $var; - $this->has_identifier_value = true; - } - - public function hasIdentifierValue() - { - return $this->has_identifier_value; - } - - /** - * <code>optional uint64 positive_int_value = 4;</code> - */ - public function getPositiveIntValue() - { - return $this->positive_int_value; - } - - /** - * <code>optional uint64 positive_int_value = 4;</code> - */ - public function setPositiveIntValue($var) - { - GPBUtil::checkUint64($var); - $this->positive_int_value = $var; - $this->has_positive_int_value = true; - } - - public function hasPositiveIntValue() - { - return $this->has_positive_int_value; - } - - /** - * <code>optional int64 negative_int_value = 5;</code> - */ - public function getNegativeIntValue() - { - return $this->negative_int_value; - } - - /** - * <code>optional int64 negative_int_value = 5;</code> - */ - public function setNegativeIntValue($var) - { - GPBUtil::checkInt64($var); - $this->negative_int_value = $var; - $this->has_negative_int_value = true; - } - - public function hasNegativeIntValue() - { - return $this->has_negative_int_value; - } - - /** - * <code>optional double double_value = 6;</code> - */ - public function getDoubleValue() - { - return $this->double_value; - } - - /** - * <code>optional double double_value = 6;</code> - */ - public function setDoubleValue($var) - { - GPBUtil::checkDouble($var); - $this->double_value = $var; - $this->has_double_value = true; - } - - public function hasDoubleValue() - { - return $this->has_double_value; - } - - /** - * <code>optional bytes string_value = 7;</code> - */ - public function getStringValue() - { - return $this->string_value; - } - - /** - * <code>optional bytes string_value = 7;</code> - */ - public function setStringValue($var) - { - GPBUtil::checkString($var, False); - $this->string_value = $var; - $this->has_string_value = true; - } - - public function hasStringValue() - { - return $this->has_string_value; - } - - /** - * <code>optional string aggregate_value = 8;</code> - */ - public function getAggregateValue() - { - return $this->aggregate_value; - } - - /** - * <code>optional string aggregate_value = 8;</code> - */ - public function setAggregateValue($var) - { - GPBUtil::checkString($var, True); - $this->aggregate_value = $var; - $this->has_aggregate_value = true; - } - - public function hasAggregateValue() - { - return $this->has_aggregate_value; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php deleted file mode 100644 index 86484d23c1..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/descriptor.proto - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\GPBWire; -use Google\Protobuf\Internal\RepeatedField; -use Google\Protobuf\Internal\InputStream; - -use Google\Protobuf\Internal\GPBUtil; - -/** - * <pre> - * The name of the uninterpreted option. Each string represents a segment in - * a dot-separated name. is_extension is true iff a segment represents an - * extension (denoted with parentheses in options specs in .proto files). - * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - * "foo.(bar.baz).qux". - * </pre> - * - * Protobuf type <code>google.protobuf.UninterpretedOption.NamePart</code> - */ -class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message -{ - /** - * <code>required string name_part = 1;</code> - */ - private $name_part = ''; - private $has_name_part = false; - /** - * <code>required bool is_extension = 2;</code> - */ - private $is_extension = false; - private $has_is_extension = false; - - public function __construct() { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); - } - - /** - * <code>required string name_part = 1;</code> - */ - public function getNamePart() - { - return $this->name_part; - } - - /** - * <code>required string name_part = 1;</code> - */ - public function setNamePart($var) - { - GPBUtil::checkString($var, True); - $this->name_part = $var; - $this->has_name_part = true; - } - - public function hasNamePart() - { - return $this->has_name_part; - } - - /** - * <code>required bool is_extension = 2;</code> - */ - public function getIsExtension() - { - return $this->is_extension; - } - - /** - * <code>required bool is_extension = 2;</code> - */ - public function setIsExtension($var) - { - GPBUtil::checkBool($var); - $this->is_extension = $var; - $this->has_is_extension = true; - } - - public function hasIsExtension() - { - return $this->has_is_extension; - } - -} - diff --git a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/descriptor.php b/third_party/protobuf/3.2.0/php/src/Google/Protobuf/descriptor.php deleted file mode 100644 index fb69eda0dc..0000000000 --- a/third_party/protobuf/3.2.0/php/src/Google/Protobuf/descriptor.php +++ /dev/null @@ -1,587 +0,0 @@ -<?php - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -namespace Google\Protobuf\Internal; - -use Google\Protobuf\Internal\GPBType; -use Google\Protobuf\Internal\MessageOptions; - -class FileDescriptor -{ - - private $package; - private $message_type = []; - private $enum_type = []; - - public function setPackage($package) - { - $this->package = $package; - } - - public function getPackage() - { - return $this->package; - } - - public function getMessageType() - { - return $this->message_type; - } - - public function addMessageType($desc) - { - $this->message_type[] = $desc; - } - - public function getEnumType() - { - return $this->enum_type; - } - - public function addEnumType($desc) - { - $this->enum_type[]= $desc; - } - - public static function buildFromProto($proto) - { - $file = new FileDescriptor(); - $file->setPackage($proto->getPackage()); - foreach ($proto->getMessageType() as $message_proto) { - $file->addMessageType(Descriptor::buildFromProto( - $message_proto, $proto, "")); - } - foreach ($proto->getEnumType() as $enum_proto) { - $file->getEnumType()[] = - $file->addEnumType( - EnumDescriptor::buildFromProto( - $enum_proto, - $proto, - "")); - } - return $file; - } -} - -class Descriptor -{ - - private $full_name; - private $field = []; - private $nested_type = []; - private $enum_type = []; - private $klass; - private $options; - private $oneof_decl = []; - - public function addOneofDecl($oneof) - { - $this->oneof_decl[] = $oneof; - } - - public function getOneofDecl() - { - return $this->oneof_decl; - } - - public function setFullName($full_name) - { - $this->full_name = $full_name; - } - - public function getFullName() - { - return $this->full_name; - } - - public function addField($field) - { - $this->field[$field->getNumber()] = $field; - } - - public function getField() - { - return $this->field; - } - - public function addNestedType($desc) - { - $this->nested_type[] = $desc; - } - - public function getNestedType() - { - return $this->nested_type; - } - - public function addEnumType($desc) - { - $this->enum_type[] = $desc; - } - - public function getEnumType() - { - return $this->enum_type; - } - - public function getFieldByNumber($number) - { - if (!isset($this->field[$number])) { - return NULL; - } else { - return $this->field[$number]; - } - } - - public function setClass($klass) - { - $this->klass = $klass; - } - - public function getClass() - { - return $this->klass; - } - - public function setOptions($options) - { - $this->options = $options; - } - - public function getOptions() - { - return $this->options; - } - - public static function buildFromProto($proto, $file_proto, $containing) - { - $desc = new Descriptor(); - - $message_name_without_package = ""; - $classname = ""; - $fullname = ""; - getFullClassName( - $proto, - $containing, - $file_proto, - $message_name_without_package, - $classname, - $fullname); - $desc->setFullName($fullname); - $desc->setClass($classname); - $desc->setOptions($proto->getOptions()); - - foreach ($proto->getField() as $field_proto) { - $desc->addField(FieldDescriptor::buildFromProto($field_proto)); - } - - // Handle nested types. - foreach ($proto->getNestedType() as $nested_proto) { - $desc->addNestedType(Descriptor::buildFromProto( - $nested_proto, $file_proto, $message_name_without_package)); - } - - // Handle nested enum. - foreach ($proto->getEnumType() as $enum_proto) { - $desc->addEnumType(EnumDescriptor::buildFromProto( - $enum_proto, $file_proto, $message_name_without_package)); - } - - // Handle oneof fields. - foreach ($proto->getOneofDecl() as $oneof_proto) { - $desc->addOneofDecl( - OneofDescriptor::buildFromProto($oneof_proto, $desc)); - } - - return $desc; - } -} - -function getClassNamePrefix( - $classname, - $file_proto) -{ - $option = $file_proto->getOptions(); - $prefix = is_null($option) ? "" : $option->getPhpClassPrefix(); - if ($prefix !== "") { - return $prefix; - } - - $reserved_words = array("Empty"); - foreach ($reserved_words as $reserved_word) { - if ($classname === $reserved_word) { - if ($file_proto->getPackage() === "google.protobuf") { - return "GPB"; - } else { - return "PB"; - } - } - } - - return ""; -} - -function getClassNameWithoutPackage( - $name, - $file_proto) -{ - $classname = implode('_', array_map('ucwords', explode('.', $name))); - return getClassNamePrefix($classname, $file_proto) . $classname; -} - -function getFullClassName( - $proto, - $containing, - $file_proto, - &$message_name_without_package, - &$classname, - &$fullname) -{ - // Full name needs to start with '.'. - $message_name_without_package = $proto->getName(); - if ($containing !== "") { - $message_name_without_package = - $containing . "." . $message_name_without_package; - } - - $package = $file_proto->getPackage(); - if ($package === "") { - $fullname = "." . $message_name_without_package; - } else { - $fullname = "." . $package . "." . $message_name_without_package; - } - - $class_name_without_package = - getClassNameWithoutPackage($message_name_without_package, $file_proto); - if ($package === "") { - $classname = $class_name_without_package; - } else { - $classname = - implode('\\', array_map('ucwords', explode('.', $package))). - "\\".$class_name_without_package; - } -} - -class OneofDescriptor -{ - - private $name; - private $fields; - - public function setName($name) - { - $this->name = $name; - } - - public function getName() - { - return $this->name; - } - - public function addField(&$field) - { - $this->fields[] = $field; - } - - public function getFields() - { - return $this->fields; - } - - public static function buildFromProto($oneof_proto) - { - $oneof = new OneofDescriptor(); - $oneof->setName($oneof_proto->getName()); - return $oneof; - } -} - - -class EnumDescriptor -{ - - private $klass; - private $full_name; - private $value; - - public function setFullName($full_name) - { - $this->full_name = $full_name; - } - - public function getFullName() - { - return $this->full_name; - } - - public function addValue($number, $value) - { - $this->value[$number] = $value; - } - - public function setClass($klass) - { - $this->klass = $klass; - } - - public function getClass() - { - return $this->klass; - } - - public static function buildFromProto($proto, $file_proto, $containing) - { - $desc = new EnumDescriptor(); - - $enum_name_without_package = ""; - $classname = ""; - $fullname = ""; - getFullClassName( - $proto, - $containing, - $file_proto, - $enum_name_without_package, - $classname, - $fullname); - $desc->setFullName($fullname); - $desc->setClass($classname); - - return $desc; - } -} - -class EnumValueDescriptor -{ -} - -class FieldDescriptor -{ - - private $name; - private $setter; - private $getter; - private $number; - private $label; - private $type; - private $message_type; - private $enum_type; - private $packed; - private $is_map; - private $oneof_index = -1; - - public function setOneofIndex($index) - { - $this->oneof_index = $index; - } - - public function getOneofIndex() - { - return $this->oneof_index; - } - - public function setName($name) - { - $this->name = $name; - } - - public function getName() - { - return $this->name; - } - - public function setSetter($setter) - { - $this->setter = $setter; - } - - public function getSetter() - { - return $this->setter; - } - - public function setGetter($getter) - { - $this->getter = $getter; - } - - public function getGetter() - { - return $this->getter; - } - - public function setNumber($number) - { - $this->number = $number; - } - - public function getNumber() - { - return $this->number; - } - - public function setLabel($label) - { - $this->label = $label; - } - - public function getLabel() - { - return $this->label; - } - - public function isRepeated() - { - return $this->label === GPBLabel::REPEATED; - } - - public function setType($type) - { - $this->type = $type; - } - - public function getType() - { - return $this->type; - } - - public function setMessageType($message_type) - { - $this->message_type = $message_type; - } - - public function getMessageType() - { - return $this->message_type; - } - - public function setEnumType($enum_type) - { - $this->enum_type = $enum_type; - } - - public function getEnumType() - { - return $this->enum_type; - } - - public function setPacked($packed) - { - $this->packed = $packed; - } - - public function getPacked() - { - return $this->packed; - } - - public function isPackable() - { - return $this->isRepeated() && self::isTypePackable($this->type); - } - - public function isMap() - { - return $this->getType() == GPBType::MESSAGE && - !is_null($this->getMessageType()->getOptions()) && - $this->getMessageType()->getOptions()->getMapEntry(); - } - - private static function isTypePackable($field_type) - { - return ($field_type !== GPBType::STRING && - $field_type !== GPBType::GROUP && - $field_type !== GPBType::MESSAGE && - $field_type !== GPBType::BYTES); - } - - public static function getFieldDescriptor( - $name, - $label, - $type, - $number, - $oneof_index, - $packed, - $type_name = null) - { - $field = new FieldDescriptor(); - $field->setName($name); - $camel_name = implode('', array_map('ucwords', explode('_', $name))); - $field->setGetter('get' . $camel_name); - $field->setSetter('set' . $camel_name); - $field->setType($type); - $field->setNumber($number); - $field->setLabel($label); - $field->setPacked($packed); - $field->setOneofIndex($oneof_index); - - // At this time, the message/enum type may have not been added to pool. - // So we use the type name as place holder and will replace it with the - // actual descriptor in cross building. - switch ($type) { - case GPBType::MESSAGE: - $field->setMessageType($type_name); - break; - case GPBType::ENUM: - $field->setEnumType($type_name); - break; - default: - break; - } - - return $field; - } - - public static function buildFromProto($proto) - { - $type_name = null; - switch ($proto->getType()) { - case GPBType::MESSAGE: - case GPBType::GROUP: - case GPBType::ENUM: - $type_name = $proto->getTypeName(); - break; - default: - break; - } - - $oneof_index = $proto->hasOneofIndex() ? $proto->getOneofIndex() : -1; - $packed = false; - $options = $proto->getOptions(); - if ($options !== null) { - $packed = $options->getPacked(); - } - - return FieldDescriptor::getFieldDescriptor( - $proto->getName(), $proto->getLabel(), $proto->getType(), - $proto->getNumber(), $oneof_index, $packed, $type_name); - } -} |