aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src/Google/Protobuf/Internal
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-11 14:44:03 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-11 14:44:03 -0700
commitde15e73d5862e8ac618bc7be90594adacbaa1ec6 (patch)
tree9d1f71f76902010963e0dc28db266de22b82646d /php/src/Google/Protobuf/Internal
parentc4083bb3d1231f8a94f2f000434e38528bdff64a (diff)
parentbd798dfc81443cb95ff3b6e0b787c92031b113e5 (diff)
Merge remote-tracking branch 'origin/3.4.x' into master
Diffstat (limited to 'php/src/Google/Protobuf/Internal')
-rw-r--r--php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php109
-rw-r--r--php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php64
-rw-r--r--php/src/Google/Protobuf/Internal/GPBUtil.php31
3 files changed, 196 insertions, 8 deletions
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php
new file mode 100644
index 00000000..6b2449fa
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php
@@ -0,0 +1,109 @@
+<?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;
+
+/**
+ * Range of reserved numeric values. Reserved values may not be used by
+ * entries in the same enum. Reserved ranges may not overlap.
+ * Note that this is distinct from DescriptorProto.ReservedRange in that it
+ * is inclusive such that it can appropriately represent the entire int32
+ * domain.
+ *
+ * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto.EnumReservedRange</code>
+ */
+class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Inclusive.
+ *
+ * Generated from protobuf field <code>optional int32 start = 1;</code>
+ */
+ private $start = 0;
+ private $has_start = false;
+ /**
+ * Inclusive.
+ *
+ * Generated from protobuf field <code>optional int32 end = 2;</code>
+ */
+ private $end = 0;
+ private $has_end = false;
+
+ public function __construct() {
+ \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
+ parent::__construct();
+ }
+
+ /**
+ * Inclusive.
+ *
+ * Generated from protobuf field <code>optional int32 start = 1;</code>
+ * @return int
+ */
+ public function getStart()
+ {
+ return $this->start;
+ }
+
+ /**
+ * Inclusive.
+ *
+ * Generated from protobuf field <code>optional int32 start = 1;</code>
+ * @param int $var
+ * @return $this
+ */
+ public function setStart($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->start = $var;
+ $this->has_start = true;
+
+ return $this;
+ }
+
+ public function hasStart()
+ {
+ return $this->has_start;
+ }
+
+ /**
+ * Inclusive.
+ *
+ * Generated from protobuf field <code>optional int32 end = 2;</code>
+ * @return int
+ */
+ public function getEnd()
+ {
+ return $this->end;
+ }
+
+ /**
+ * Inclusive.
+ *
+ * Generated from protobuf field <code>optional int32 end = 2;</code>
+ * @param int $var
+ * @return $this
+ */
+ public function setEnd($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->end = $var;
+ $this->has_end = true;
+
+ return $this;
+ }
+
+ public function hasEnd()
+ {
+ return $this->has_end;
+ }
+
+}
+
diff --git a/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php b/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php
new file mode 100644
index 00000000..ee9e38bb
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php
@@ -0,0 +1,64 @@
+<?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;
+
+/**
+ * Generated from protobuf message <code>google.protobuf.ExtensionRangeOptions</code>
+ */
+class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The parser stores options it doesn't recognize here. See above.
+ *
+ * Generated from protobuf field <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();
+ }
+
+ /**
+ * The parser stores options it doesn't recognize here. See above.
+ *
+ * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getUninterpretedOption()
+ {
+ return $this->uninterpreted_option;
+ }
+
+ /**
+ * The parser stores options it doesn't recognize here. See above.
+ *
+ * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+ * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ 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;
+
+ return $this;
+ }
+
+ public function hasUninterpretedOption()
+ {
+ return $this->has_uninterpreted_option;
+ }
+
+}
+
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index a27220a0..7fa4a673 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -255,14 +255,29 @@ class GPBUtil
return $prefix;
}
- $reserved_words = array("Empty", "ECHO", "ARRAY");
- foreach ($reserved_words as $reserved_word) {
- if ($classname === $reserved_word) {
- if ($file_proto->getPackage() === "google.protobuf") {
- return "GPB";
- } else {
- return "PB";
- }
+ $reserved_words = array(
+ "abstract"=>0, "and"=>0, "array"=>0, "as"=>0, "break"=>0,
+ "callable"=>0, "case"=>0, "catch"=>0, "class"=>0, "clone"=>0,
+ "const"=>0, "continue"=>0, "declare"=>0, "default"=>0, "die"=>0,
+ "do"=>0, "echo"=>0, "else"=>0, "elseif"=>0, "empty"=>0,
+ "enddeclare"=>0, "endfor"=>0, "endforeach"=>0, "endif"=>0,
+ "endswitch"=>0, "endwhile"=>0, "eval"=>0, "exit"=>0, "extends"=>0,
+ "final"=>0, "for"=>0, "foreach"=>0, "function"=>0, "global"=>0,
+ "goto"=>0, "if"=>0, "implements"=>0, "include"=>0,
+ "include_once"=>0, "instanceof"=>0, "insteadof"=>0, "interface"=>0,
+ "isset"=>0, "list"=>0, "namespace"=>0, "new"=>0, "or"=>0,
+ "print"=>0, "private"=>0, "protected"=>0, "public"=>0, "require"=>0,
+ "require_once"=>0, "return"=>0, "static"=>0, "switch"=>0,
+ "throw"=>0, "trait"=>0, "try"=>0, "unset"=>0, "use"=>0, "var"=>0,
+ "while"=>0, "xor"=>0, "int"=>0, "float"=>0, "bool"=>0, "string"=>0,
+ "true"=>0, "false"=>0, "null"=>0, "void"=>0, "iterable"=>0
+ );
+
+ if (array_key_exists(strtolower($classname), $reserved_words)) {
+ if ($file_proto->getPackage() === "google.protobuf") {
+ return "GPB";
+ } else {
+ return "PB";
}
}