From 21b0e5587c01948927ede9be789671ff116b7ad4 Mon Sep 17 00:00:00 2001 From: michaelbausor Date: Fri, 4 Aug 2017 16:35:22 -0700 Subject: Update PHP descriptors (#3391) * Add descriptors test * Update descriptors tests * Add public descriptors * Add test_desriptors.proto to test script * Update composer files * Remove references to GPBType, update tests to be compatible with c * Update for c extension compatibility * Remove nested enums for descriptor, update tests * Strip leading '.' from descriptor name * Update tests with test for getClass, fix OneofDescriptor * Add new files to Makefile.am --- php/src/Google/Protobuf/EnumDescriptor.php | 79 ++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 php/src/Google/Protobuf/EnumDescriptor.php (limited to 'php/src/Google/Protobuf/EnumDescriptor.php') diff --git a/php/src/Google/Protobuf/EnumDescriptor.php b/php/src/Google/Protobuf/EnumDescriptor.php new file mode 100644 index 00000000..a8b56c0d --- /dev/null +++ b/php/src/Google/Protobuf/EnumDescriptor.php @@ -0,0 +1,79 @@ +internal_desc = $internal_desc; + } + + /** + * @return string Full protobuf message name + */ + public function getFullName() + { + return $this->internal_desc->getFullName(); + } + + /** + * @return string PHP class name + */ + public function getClass() + { + return $this->internal_desc->getClass(); + } + + /** + * @param int $index Must be >= 0 and < getValueCount() + * @return EnumValueDescriptor + */ + public function getValue($index) + { + return $this->internal_desc->getValueDescriptorByIndex($index); + } + + /** + * @return int Number of values in enum + */ + public function getValueCount() + { + return $this->internal_desc->getValueCount(); + } +} -- cgit v1.2.3