--- a/lib/Protobuf-PHP/tests/protos/repeated.php +++ b/lib/Protobuf-PHP/tests/protos/repeated.php @@ -1,1 +1,302 @@ - +number = 1; + $f->name = "string"; + $f->type = 9; + $f->rule = 3; + $descriptor->addField($f); + + // repeated int = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "int"; + $f->type = 5; + $f->rule = 3; + $descriptor->addField($f); + + // repeated .tests.Repeated.Nested nested = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "nested"; + $f->type = 11; + $f->rule = 3; + $f->reference = '\tests\Repeated\Nested'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + + /** @var string[] */ + public $string = array(); + + /** @var int[] */ + public $int = array(); + + /** @var \tests\Repeated\Nested[] */ + public $nested = array(); + + + /** + * Check if has a value + * + * @return boolean + */ + public function hasString(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \tests\Repeated + */ + public function clearString(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @param int $idx + * @return string + */ + public function getString($idx = NULL){ + return $this->_get(1, $idx); + } + + /** + * Set value + * + * @param string $value + * @return \tests\Repeated + */ + public function setString( $value, $idx = NULL){ + return $this->_set(1, $value, $idx); + } + + /** + * Get all elements of + * + * @return string[] + */ + public function getStringList(){ + return $this->_get(1); + } + + /** + * Add a new element to + * + * @param string $value + * @return \tests\Repeated + */ + public function addString( $value){ + return $this->_add(1, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasInt(){ + return $this->_has(2); + } + + /** + * Clear value + * + * @return \tests\Repeated + */ + public function clearInt(){ + return $this->_clear(2); + } + + /** + * Get value + * + * @param int $idx + * @return int + */ + public function getInt($idx = NULL){ + return $this->_get(2, $idx); + } + + /** + * Set value + * + * @param int $value + * @return \tests\Repeated + */ + public function setInt( $value, $idx = NULL){ + return $this->_set(2, $value, $idx); + } + + /** + * Get all elements of + * + * @return int[] + */ + public function getIntList(){ + return $this->_get(2); + } + + /** + * Add a new element to + * + * @param int $value + * @return \tests\Repeated + */ + public function addInt( $value){ + return $this->_add(2, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasNested(){ + return $this->_has(3); + } + + /** + * Clear value + * + * @return \tests\Repeated + */ + public function clearNested(){ + return $this->_clear(3); + } + + /** + * Get value + * + * @param int $idx + * @return \tests\Repeated\Nested + */ + public function getNested($idx = NULL){ + return $this->_get(3, $idx); + } + + /** + * Set value + * + * @param \tests\Repeated\Nested $value + * @return \tests\Repeated + */ + public function setNested(\tests\Repeated\Nested $value, $idx = NULL){ + return $this->_set(3, $value, $idx); + } + + /** + * Get all elements of + * + * @return \tests\Repeated\Nested[] + */ + public function getNestedList(){ + return $this->_get(3); + } + + /** + * Add a new element to + * + * @param \tests\Repeated\Nested $value + * @return \tests\Repeated + */ + public function addNested(\tests\Repeated\Nested $value){ + return $this->_add(3, $value); + } + + } +} + +namespace tests\Repeated { + + class Nested extends \DrSlump\Protobuf\Message { + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + { + $descriptor = new \DrSlump\Protobuf\Descriptor('\tests\Repeated\Nested'); + + // optional id = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "id"; + $f->type = 5; + $f->rule = 1; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + + /** @var int */ + public $id = null; + + + /** + * Check if has a value + * + * @return boolean + */ + public function hasId(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \tests\Repeated\Nested + */ + public function clearId(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @return int + */ + public function getId(){ + return $this->_get(1); + } + + /** + * Set value + * + * @param int $value + * @return \tests\Repeated\Nested + */ + public function setId( $value){ + return $this->_set(1, $value); + } + + } +} +