From b9b34e9b1167d89c4df8f0abffe31262aebe7a39 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 14 Jun 2017 15:57:11 -0700 Subject: 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 --- .../Google/Protobuf/Internal/RepeatedFieldIter.php | 118 +++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 php/src/Google/Protobuf/Internal/RepeatedFieldIter.php (limited to 'php/src/Google/Protobuf/Internal/RepeatedFieldIter.php') diff --git a/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php b/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php new file mode 100644 index 00000000..2b6f8230 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php @@ -0,0 +1,118 @@ +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]); + } +} -- cgit v1.2.3