aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src/Google/Protobuf/Internal/EnumDescriptor.php
diff options
context:
space:
mode:
authorGravatar Brent Shaffer <betterbrent@google.com>2017-06-14 15:57:11 -0700
committerGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-06-14 15:57:11 -0700
commitb9b34e9b1167d89c4df8f0abffe31262aebe7a39 (patch)
tree90bd518f966f24ea48fe2472e68409868501abfa /php/src/Google/Protobuf/Internal/EnumDescriptor.php
parent09d2994b1f68160508d9188f9bdb1a2a3b527e1e (diff)
Follows proper autoloading standards (#3123)
* Follows proper autoloading standards - Splits PHP classes in descriptor.php into separate files - Splits MapFieldIter and RepeatedFieldIter into separate files - Moves descriptor.php to Internal/functions.php - Moves all namespaced functions into Iternal/functions.php * fixes Makefile.am for added php files * [PHP] moves all functions to GPBUtil * removes description.php from the makefile
Diffstat (limited to 'php/src/Google/Protobuf/Internal/EnumDescriptor.php')
-rw-r--r--php/src/Google/Protobuf/Internal/EnumDescriptor.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptor.php b/php/src/Google/Protobuf/Internal/EnumDescriptor.php
new file mode 100644
index 00000000..7360a477
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptor.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Google\Protobuf\Internal;
+
+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 = "";
+ GPBUtil::getFullClassName(
+ $proto,
+ $containing,
+ $file_proto,
+ $enum_name_without_package,
+ $classname,
+ $fullname);
+ $desc->setFullName($fullname);
+ $desc->setClass($classname);
+
+ return $desc;
+ }
+}